compiletest: make path normalization smarter

This commit is contained in:
Andy Russell 2019-03-13 00:47:36 -04:00
parent 46914715e2
commit 695dfe7dff
No known key found for this signature in database
GPG key ID: BE2221033EDBC374
35 changed files with 247 additions and 154 deletions

View file

@ -9,7 +9,7 @@ note: lint level defined here
|
LL | #![deny(intra_doc_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ note: lint level defined here
|
LL | #![deny(intra_doc_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ note: lint level defined here
|
LL | #![deny(intra_doc_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: aborting due to previous error

View file

@ -5,7 +5,7 @@ LL | /// [error]
| ^^^^^ cannot be resolved, ignoring
|
= note: #[warn(intra_doc_link_resolution_failure)] on by default
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error1]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning-crlf.rs:12:11
@ -13,7 +13,7 @@ warning: `[error1]` cannot be resolved, ignoring it...
LL | /// docs [error1]
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error2]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning-crlf.rs:14:11
@ -21,7 +21,7 @@ warning: `[error2]` cannot be resolved, ignoring it...
LL | /// docs [error2]
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning-crlf.rs:21:20
@ -29,5 +29,5 @@ warning: `[error]` cannot be resolved, ignoring it...
LL | * It also has an [error].
| ^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

View file

@ -5,7 +5,7 @@ LL | //! Test with [Foo::baz], [Bar::foo], ...
| ^^^^^^^^ cannot be resolved, ignoring
|
= note: #[warn(intra_doc_link_resolution_failure)] on by default
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Bar::foo]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:3:35
@ -13,7 +13,7 @@ warning: `[Bar::foo]` cannot be resolved, ignoring it...
LL | //! Test with [Foo::baz], [Bar::foo], ...
| ^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Uniooon::X]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:4:13
@ -21,7 +21,7 @@ warning: `[Uniooon::X]` cannot be resolved, ignoring it...
LL | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Qux::Z]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:4:30
@ -29,7 +29,7 @@ warning: `[Qux::Z]` cannot be resolved, ignoring it...
LL | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Uniooon::X]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:6:14
@ -37,7 +37,7 @@ warning: `[Uniooon::X]` cannot be resolved, ignoring it...
LL | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Qux::Z]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:6:31
@ -45,7 +45,7 @@ warning: `[Qux::Z]` cannot be resolved, ignoring it...
LL | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Qux:Y]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:8:13
@ -53,7 +53,7 @@ warning: `[Qux:Y]` cannot be resolved, ignoring it...
LL | /// [Qux:Y]
| ^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:51:30
@ -61,7 +61,7 @@ warning: `[error]` cannot be resolved, ignoring it...
LL | * time to introduce a link [error]*/
| ^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:57:30
@ -69,7 +69,7 @@ warning: `[error]` cannot be resolved, ignoring it...
LL | * time to introduce a link [error]
| ^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:61:1
@ -81,19 +81,19 @@ LL | #[doc = "single line [error]"]
single line [error]
^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:64:1
|
LL | #[doc = "single line with /"escaping/" [error]"]
LL | #[doc = "single line with \"escaping\" [error]"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the link appears in this line:
single line with "escaping" [error]
^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:67:1
@ -107,7 +107,7 @@ LL | | /// [error]
[error]
^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error1]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:73:11
@ -115,7 +115,7 @@ warning: `[error1]` cannot be resolved, ignoring it...
LL | /// docs [error1]
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[error2]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:75:11
@ -123,7 +123,7 @@ warning: `[error2]` cannot be resolved, ignoring it...
LL | /// docs [error2]
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[BarA]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:14:10
@ -131,7 +131,7 @@ warning: `[BarA]` cannot be resolved, ignoring it...
LL | /// bar [BarA] bar
| ^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[BarB]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:20:9
@ -139,7 +139,7 @@ warning: `[BarB]` cannot be resolved, ignoring it...
LL | * bar [BarB] bar
| ^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[BarC]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:27:6
@ -147,19 +147,19 @@ warning: `[BarC]` cannot be resolved, ignoring it...
LL | bar [BarC] bar
| ^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[BarD]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:38:1
|
LL | #[doc = "Foo/nbar [BarD] bar/nbaz"]
LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the link appears in this line:
bar [BarD] bar
^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[BarF]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:43:9
@ -167,12 +167,12 @@ warning: `[BarF]` cannot be resolved, ignoring it...
LL | #[doc = $f]
| ^^^^^^^^^^^
...
LL | f!("Foo/nbar [BarF] bar/nbaz");
LL | f!("Foo\nbar [BarF] bar\nbaz");
| ------------------------------- in this macro invocation
|
= note: the link appears in this line:
bar [BarF] bar
^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

View file

@ -3,11 +3,11 @@ warning: could not parse code block as Rust code
|
LL | /// ```
| _____^
LL | | /// /__________pkt->size___________/ /_result->size_/ /__pkt->size__/
LL | | /// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/
LL | | /// ```
| |_______^
|
= note: error from rustc: unknown start of token: /
= note: error from rustc: unknown start of token: \
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@ -35,11 +35,11 @@ warning: could not parse code block as Rust code
|
LL | /// ```
| _____^
LL | | /// /_
LL | | /// \_
LL | | /// ```
| |_______^
|
= note: error from rustc: unknown start of token: /
= note: error from rustc: unknown start of token: \
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@ -50,21 +50,21 @@ warning: could not parse code block as Rust code
|
LL | /// ```rust
| _____^
LL | | /// /_
LL | | /// \_
LL | | /// ```
| |_______^
|
= note: error from rustc: unknown start of token: /
= note: error from rustc: unknown start of token: \
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:41:9
|
LL | /// code with bad syntax
| _________^
LL | | /// /_
LL | | /// \_
| |__________^
|
= note: error from rustc: unknown start of token: /
= note: error from rustc: unknown start of token: \
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:55:9
@ -79,17 +79,17 @@ warning: could not parse code block as Rust code
|
LL | /// ```edition2018
| _____^
LL | | /// /_
LL | | /// \_
LL | | /// ```
| |_______^
|
= note: error from rustc: unknown start of token: /
= note: error from rustc: unknown start of token: \
warning: doc comment contains an invalid Rust code block
--> $DIR/invalid-syntax.rs:63:1
|
LL | / #[doc = "```"]
LL | | /// /_
LL | | /// \_
LL | | #[doc = "```"]
| |______________^
|

View file

@ -27,7 +27,7 @@ note: lint level defined here
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: #[deny(intra_doc_link_resolution_failure)] implied by #[deny(rustdoc)]
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: Missing code example in this documentation
--> $DIR/lint-group.rs:16:1

View file

@ -2,7 +2,7 @@ error: only u8 can be cast into char
--> $DIR/cast_char.rs:4:23
|
LL | const XYZ: char = 0x1F888 as char;
| ^^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'`
| ^^^^^^^^^^^^^^^ help: use a char literal instead: `'\u{1F888}'`
|
note: lint level defined here
--> $DIR/cast_char.rs:1:9
@ -14,7 +14,7 @@ error: only u8 can be cast into char
--> $DIR/cast_char.rs:6:22
|
LL | const XY: char = 129160 as char;
| ^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'`
| ^^^^^^^^^^^^^^ help: use a char literal instead: `'\u{1F888}'`
error: aborting due to 2 previous errors

View file

@ -1,7 +1,7 @@
error[E0648]: `export_name` may not contain null characters
--> $DIR/E0648.rs:1:1
|
LL | #[export_name="/0foo"]
LL | #[export_name="\0foo"]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,10 +1,10 @@
error: incorrect unicode escape sequence
--> $DIR/format-string-error-2.rs:77:20
|
LL | println!("/x7B}/u8 {", 1);
LL | println!("\x7B}\u8 {", 1);
| ^^-
| |
| help: format of unicode escape sequences uses braces: `/u{8}`
| help: format of unicode escape sequences uses braces: `\u{8}`
error: invalid format string: expected `'}'`, found `'a'`
--> $DIR/format-string-error-2.rs:5:5
@ -19,7 +19,7 @@ LL | a");
error: invalid format string: expected `'}'`, found `'b'`
--> $DIR/format-string-error-2.rs:9:5
|
LL | format!("{ /
LL | format!("{ \
| - because of this opening brace
LL |
LL | b");
@ -27,20 +27,20 @@ LL | b");
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `'}'`, found `'/'`
error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:11:18
|
LL | format!(r#"{ /
LL | format!(r#"{ \
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `'}'`, found `'/'`
error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:15:18
|
LL | format!(r#"{ /n
LL | format!(r#"{ \n
| - ^ expected `}` in format string
| |
| because of this opening brace
@ -50,9 +50,9 @@ LL | format!(r#"{ /n
error: invalid format string: expected `'}'`, found `'e'`
--> $DIR/format-string-error-2.rs:21:5
|
LL | format!("{ /n
LL | format!("{ \n
| - because of this opening brace
LL | /n
LL | \n
LL | e");
| ^ expected `}` in format string
|
@ -81,9 +81,9 @@ LL | a
error: invalid format string: expected `'}'`, found `'b'`
--> $DIR/format-string-error-2.rs:35:5
|
LL | { /
LL | { \
| - because of this opening brace
LL | /
LL | \
LL | b");
| ^ expected `}` in format string
|
@ -92,28 +92,28 @@ LL | b");
error: invalid format string: expected `'}'`, found `'b'`
--> $DIR/format-string-error-2.rs:40:5
|
LL | { /
LL | { \
| - because of this opening brace
LL | /
LL | b /
LL | \
LL | b \
| ^ expected `}` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `'}'`, found `'/'`
error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:45:8
|
LL | raw { /
LL | raw { \
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `'}'`, found `'/'`
error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:50:8
|
LL | raw { /n
LL | raw { \n
| - ^ expected `}` in format string
| |
| because of this opening brace
@ -123,9 +123,9 @@ LL | raw { /n
error: invalid format string: expected `'}'`, found `'e'`
--> $DIR/format-string-error-2.rs:57:5
|
LL | { /n
LL | { \n
| - because of this opening brace
LL | /n
LL | \n
LL | e");
| ^ expected `}` in format string
|
@ -144,13 +144,13 @@ LL | asdf}
error: 1 positional argument in format string, but no arguments were given
--> $DIR/format-string-error-2.rs:70:17
|
LL | println!("/t{}");
LL | println!("\t{}");
| ^^
error: invalid format string: expected `'}'` but string was terminated
--> $DIR/format-string-error-2.rs:74:27
|
LL | println!("/x7B}/u{8} {", 1);
LL | println!("\x7B}\u{8} {", 1);
| -^ expected `'}'` in format string
| |
| because of this opening brace
@ -160,7 +160,7 @@ LL | println!("/x7B}/u{8} {", 1);
error: argument never used
--> $DIR/format-string-error-2.rs:77:28
|
LL | println!("/x7B}/u8 {", 1);
LL | println!("\x7B}\u8 {", 1);
| ------------ ^ argument never used
| |
| formatting specifier missing
@ -168,7 +168,7 @@ LL | println!("/x7B}/u8 {", 1);
error: invalid format string: unmatched `}` found
--> $DIR/format-string-error-2.rs:82:21
|
LL | println!(r#"/x7B}/u{8} {"#, 1);
LL | println!(r#"\x7B}\u{8} {"#, 1);
| ^ unmatched `}` in format string
|
= note: if you intended to print `}`, you can escape it using `}}`
@ -176,7 +176,7 @@ LL | println!(r#"/x7B}/u{8} {"#, 1);
error: invalid format string: unmatched `}` found
--> $DIR/format-string-error-2.rs:85:21
|
LL | println!(r#"/x7B}/u8 {"#, 1);
LL | println!(r#"\x7B}\u8 {"#, 1);
| ^ unmatched `}` in format string
|
= note: if you intended to print `}`, you can escape it using `}}`

View file

@ -50,10 +50,10 @@ LL | let _ = format!("}");
|
= note: if you intended to print `}`, you can escape it using `}}`
error: invalid format string: expected `'}'`, found `'/'`
error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error.rs:17:23
|
LL | let _ = format!("{/}");
LL | let _ = format!("{\}");
| -^ expected `}` in format string
| |
| because of this opening brace
@ -63,7 +63,7 @@ LL | let _ = format!("{/}");
error: invalid format string: expected `'}'` but string was terminated
--> $DIR/format-string-error.rs:19:35
|
LL | let _ = format!("/n/n/n{/n/n/n");
LL | let _ = format!("\n\n\n{\n\n\n");
| - ^ expected `'}'` in format string
| |
| because of this opening brace

View file

@ -1,7 +1,7 @@
error: unreachable pattern
--> $DIR/issue-13727.rs:7:5
|
LL | 512 => print!("0b1111/n"),
LL | 512 => print!("0b1111\n"),
| ^^^
|
note: lint level defined here

View file

@ -1,7 +1,7 @@
error: multiple unused formatting arguments
--> $DIR/format-foreign.rs:2:30
|
LL | println!("%.*3$s %s!/n", "Hello,", "World", 4);
LL | println!("%.*3$s %s!\n", "Hello,", "World", 4);
| -------------- ^^^^^^^^ ^^^^^^^ ^ argument never used
| | | |
| | | argument never used
@ -11,7 +11,7 @@ LL | println!("%.*3$s %s!/n", "Hello,", "World", 4);
= note: printf formatting not supported; see the documentation for `std::fmt`
help: format specifiers use curly braces
|
LL | println!("{:.2$} {}!/n", "Hello,", "World", 4);
LL | println!("{:.2$} {}!\n", "Hello,", "World", 4);
| ^^^^^^ ^^
error: argument never used
@ -29,7 +29,7 @@ error: multiple unused formatting arguments
|
LL | println!(r###"%.*3$s
| ______________-
LL | | %s!/n
LL | | %s!\n
LL | | "###, "Hello,", "World", 4);
| | - ^^^^^^^^ ^^^^^^^ ^ argument never used
| | | | |
@ -41,7 +41,7 @@ LL | | "###, "Hello,", "World", 4);
help: format specifiers use curly braces
|
LL | println!(r###"{:.2$}
LL | {}!/n
LL | {}!\n
|
error: argument never used

View file

@ -1,7 +1,7 @@
error: 1 positional argument in format string, but no arguments were given
--> $DIR/macro-backtrace-println.rs:14:30
|
LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n")));
LL | ($fmt:expr) => (myprint!(concat!($fmt, "\n")));
| ^^^^^^^^^^^^^^^^^^^
...
LL | myprintln!("{}");

View file

@ -1,19 +1,19 @@
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:4:16
|
LL | let x = "/x80";
LL | let x = "\x80";
| ^^
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:5:16
|
LL | let y = "/xff";
LL | let y = "\xff";
| ^^
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:6:16
|
LL | let z = "/xe2";
LL | let z = "\xe2";
| ^^
error: aborting due to 3 previous errors

View file

@ -4,7 +4,7 @@ error: character constant must be escaped: '
LL | ''';
| ^
error: character constant must be escaped: /n
error: character constant must be escaped: \n
--> $DIR/bad-char-literals.rs:11:6
|
LL | '
@ -12,13 +12,13 @@ LL | '
LL | | ';
| |_
error: character constant must be escaped: /r
error: character constant must be escaped: \r
--> $DIR/bad-char-literals.rs:16:6
|
LL | ' ';
| ^
error: character constant must be escaped: /t
error: character constant must be escaped: \t
--> $DIR/bad-char-literals.rs:19:6
|
LL | ' ';

View file

@ -1,22 +1,22 @@
error: unknown byte escape: f
--> $DIR/byte-literals.rs:6:21
|
LL | static FOO: u8 = b'/f';
LL | static FOO: u8 = b'\f';
| ^ unknown byte escape
error: unknown byte escape: f
--> $DIR/byte-literals.rs:9:8
|
LL | b'/f';
LL | b'\f';
| ^ unknown byte escape
error: invalid character in numeric character escape: Z
--> $DIR/byte-literals.rs:10:10
|
LL | b'/x0Z';
LL | b'\x0Z';
| ^
error: byte constant must be escaped: /t
error: byte constant must be escaped: \t
--> $DIR/byte-literals.rs:11:7
|
LL | b' ';
@ -28,7 +28,7 @@ error: byte constant must be escaped: '
LL | b''';
| ^
error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte
error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte
--> $DIR/byte-literals.rs:13:7
|
LL | b'é';

View file

@ -1,22 +1,22 @@
error: unknown byte escape: f
--> $DIR/byte-string-literals.rs:6:32
|
LL | static FOO: &'static [u8] = b"/f";
LL | static FOO: &'static [u8] = b"\f";
| ^ unknown byte escape
error: unknown byte escape: f
--> $DIR/byte-string-literals.rs:9:8
|
LL | b"/f";
LL | b"\f";
| ^ unknown byte escape
error: invalid character in numeric character escape: Z
--> $DIR/byte-string-literals.rs:10:10
|
LL | b"/x0Z";
LL | b"\x0Z";
| ^
error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte
error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte
--> $DIR/byte-string-literals.rs:11:7
|
LL | b"é";

View file

@ -1,118 +1,118 @@
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:4:15
|
LL | let _ = b"/u{a66e}";
LL | let _ = b"\u{a66e}";
| ^^^^^^^^
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:7:15
|
LL | let _ = b'/u{a66e}';
LL | let _ = b'\u{a66e}';
| ^^^^^^^^
error: incorrect unicode escape sequence
--> $DIR/issue-23620-invalid-escapes.rs:10:15
|
LL | let _ = b'/u';
LL | let _ = b'\u';
| ^^ incorrect unicode escape sequence
|
= help: format of unicode escape sequences is `/u{...}`
= help: format of unicode escape sequences is `\u{...}`
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:10:15
|
LL | let _ = b'/u';
LL | let _ = b'\u';
| ^^
error: numeric character escape is too short
--> $DIR/issue-23620-invalid-escapes.rs:14:17
|
LL | let _ = b'/x5';
LL | let _ = b'\x5';
| ^
error: invalid character in numeric character escape: x
--> $DIR/issue-23620-invalid-escapes.rs:17:17
|
LL | let _ = b'/xxy';
LL | let _ = b'\xxy';
| ^
error: invalid character in numeric character escape: y
--> $DIR/issue-23620-invalid-escapes.rs:17:18
|
LL | let _ = b'/xxy';
LL | let _ = b'\xxy';
| ^
error: numeric character escape is too short
--> $DIR/issue-23620-invalid-escapes.rs:21:16
|
LL | let _ = '/x5';
LL | let _ = '\x5';
| ^
error: invalid character in numeric character escape: x
--> $DIR/issue-23620-invalid-escapes.rs:24:16
|
LL | let _ = '/xxy';
LL | let _ = '\xxy';
| ^
error: invalid character in numeric character escape: y
--> $DIR/issue-23620-invalid-escapes.rs:24:17
|
LL | let _ = '/xxy';
LL | let _ = '\xxy';
| ^
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:28:15
|
LL | let _ = b"/u{a4a4} /xf /u";
LL | let _ = b"\u{a4a4} \xf \u";
| ^^^^^^^^
error: invalid character in numeric character escape:
--> $DIR/issue-23620-invalid-escapes.rs:28:27
|
LL | let _ = b"/u{a4a4} /xf /u";
LL | let _ = b"\u{a4a4} \xf \u";
| ^
error: incorrect unicode escape sequence
--> $DIR/issue-23620-invalid-escapes.rs:28:28
|
LL | let _ = b"/u{a4a4} /xf /u";
LL | let _ = b"\u{a4a4} \xf \u";
| ^^ incorrect unicode escape sequence
|
= help: format of unicode escape sequences is `/u{...}`
= help: format of unicode escape sequences is `\u{...}`
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:28:28
|
LL | let _ = b"/u{a4a4} /xf /u";
LL | let _ = b"\u{a4a4} \xf \u";
| ^^
error: invalid character in numeric character escape:
--> $DIR/issue-23620-invalid-escapes.rs:34:17
|
LL | let _ = "/xf /u";
LL | let _ = "\xf \u";
| ^
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/issue-23620-invalid-escapes.rs:34:16
|
LL | let _ = "/xf /u";
LL | let _ = "\xf \u";
| ^^
error: incorrect unicode escape sequence
--> $DIR/issue-23620-invalid-escapes.rs:34:18
|
LL | let _ = "/xf /u";
LL | let _ = "\xf \u";
| ^^ incorrect unicode escape sequence
|
= help: format of unicode escape sequences is `/u{...}`
= help: format of unicode escape sequences is `\u{...}`
error: incorrect unicode escape sequence
--> $DIR/issue-23620-invalid-escapes.rs:39:14
|
LL | let _ = "/u8f";
LL | let _ = "\u8f";
| ^^--
| |
| help: format of unicode escape sequences uses braces: `/u{8f}`
| help: format of unicode escape sequences uses braces: `\u{8f}`
error: aborting due to 18 previous errors

View file

@ -1,7 +1,7 @@
error: invalid start of unicode escape
--> $DIR/issue-43692.rs:2:9
|
LL | '/u{_10FFFF}';
LL | '\u{_10FFFF}';
| ^
error: aborting due to previous error

View file

@ -1,25 +1,25 @@
error: numeric character escape is too short
--> $DIR/lex-bad-char-literals-1.rs:3:8
|
LL | '/x1'
LL | '\x1'
| ^
error: numeric character escape is too short
--> $DIR/lex-bad-char-literals-1.rs:7:8
|
LL | "/x1"
LL | "\x1"
| ^
error: unknown character escape: /u{25cf}
error: unknown character escape: \u{25cf}
--> $DIR/lex-bad-char-literals-1.rs:11:7
|
LL | '/●'
LL | '\●'
| ^ unknown character escape
error: unknown character escape: /u{25cf}
error: unknown character escape: \u{25cf}
--> $DIR/lex-bad-char-literals-1.rs:15:7
|
LL | "/●"
LL | "\●"
| ^ unknown character escape
error: aborting due to 4 previous errors

View file

@ -1,21 +1,21 @@
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-5.rs:1:18
|
LL | static c: char = '/x10/x10';
LL | static c: char = '\x10\x10';
| ^^^^^^^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | static c: char = "/x10/x10";
LL | static c: char = "\x10\x10";
| ^^^^^^^^^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-5.rs:5:20
|
LL | let ch: &str = '/x10/x10';
LL | let ch: &str = '\x10\x10';
| ^^^^^^^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | let ch: &str = "/x10/x10";
LL | let ch: &str = "\x10\x10";
| ^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,4 +1,4 @@
error: unknown start of token: /u{25cf}
error: unknown start of token: \u{25cf}
--> $DIR/lex-bad-token.rs:1:1
|
LL | ●

View file

@ -22,22 +22,22 @@ error: bare CR not allowed in block doc-comment
LL | /*! block doc comment with bare CR: ' ' */
| ^
error: bare CR not allowed in string, use /r instead
error: bare CR not allowed in string, use \r instead
--> $DIR/lex-bare-cr-string-literal-doc-comment.rs:21:18
|
LL | let _s = "foo bar";
| ^
error: bare CR not allowed in raw string, use /r instead
error: bare CR not allowed in raw string, use \r instead
--> $DIR/lex-bare-cr-string-literal-doc-comment.rs:24:14
|
LL | let _s = r"bar foo";
| ^^^^^
error: unknown character escape: /r
error: unknown character escape: \r
--> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19
|
LL | let _s = "foo/ bar";
LL | let _s = "foo\ bar";
| ^ unknown character escape
|
= help: this is an isolated carriage return; consider checking your editor and version control settings

View file

@ -1,7 +1,7 @@
error: unknown start of token: /
error: unknown start of token: \
--> $DIR/lex-stray-backslash.rs:1:1
|
LL | /
LL | \
| ^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error: unterminated unicode escape (needed a `}`)
--> $DIR/new-unicode-escapes-1.rs:2:21
|
LL | let s = "/u{2603";
LL | let s = "\u{2603";
| ^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error: overlong unicode escape (must have at most 6 hex digits)
--> $DIR/new-unicode-escapes-2.rs:2:17
|
LL | let s = "/u{260311111111}";
LL | let s = "\u{260311111111}";
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error: invalid unicode character escape
--> $DIR/new-unicode-escapes-3.rs:2:14
|
LL | let s1 = "/u{d805}";
LL | let s1 = "\u{d805}";
| ^^^^^^^^^^
|
= help: unicode escape must not be a surrogate
@ -9,7 +9,7 @@ LL | let s1 = "/u{d805}";
error: invalid unicode character escape
--> $DIR/new-unicode-escapes-3.rs:3:14
|
LL | let s2 = "/u{ffffff}";
LL | let s2 = "\u{ffffff}";
| ^^^^^^^^^^^^
|
= help: unicode escape must be at most 10FFFF

View file

@ -1,7 +1,7 @@
error: invalid character in unicode escape: l
--> $DIR/new-unicode-escapes-4.rs:4:17
|
LL | let s = "/u{lol}";
LL | let s = "\u{lol}";
| ^
error: aborting due to previous error

View file

@ -1,4 +1,4 @@
error: raw byte string must be ASCII: /u{e9}
error: raw byte string must be ASCII: \u{e9}
--> $DIR/raw-byte-string-literals.rs:5:8
|
LL | br"é";

View file

@ -1,7 +1,7 @@
error: unknown character escape: /r
error: unknown character escape: \r
--> $DIR/trailing-carriage-return-in-string.rs:10:25
|
LL | let bad = "This is / a test";
LL | let bad = "This is \ a test";
| ^ unknown character escape
|
= help: this is an isolated carriage return; consider checking your editor and version control settings

View file

@ -1,4 +1,4 @@
error: unknown start of token: /u{37e}
error: unknown start of token: \u{37e}
--> $DIR/unicode-chars.rs:2:14
|
LL | let y = 0;

View file

@ -1,4 +1,4 @@
error: unknown start of token: /u{201c}
error: unknown start of token: \u{201c}
--> $DIR/unicode-quote-chars.rs:4:14
|
LL | println!(“hello world”);

View file

@ -1,7 +1,7 @@
error: unknown character escape: {
--> $DIR/wrong-escape-of-curly-braces.rs:3:17
|
LL | let bad = "/{it is wrong/}";
LL | let bad = "\{it is wrong\}";
| ^ unknown character escape
|
= help: if used in a formatting string, curly braces are escaped with `{{` and `}}`
@ -9,7 +9,7 @@ LL | let bad = "/{it is wrong/}";
error: unknown character escape: }
--> $DIR/wrong-escape-of-curly-braces.rs:3:30
|
LL | let bad = "/{it is wrong/}";
LL | let bad = "\{it is wrong\}";
| ^ unknown character escape
|
= help: if used in a formatting string, curly braces are escaped with `{{` and `}}`

View file

@ -10,7 +10,7 @@
use filetime::FileTime;
use crate::header::TestProps;
use crate::json;
use regex::Regex;
use regex::{Captures, Regex};
use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
use crate::util::{logv, PathBufExt};
@ -3147,10 +3147,8 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
normalized = Regex::new("SRC_DIR(.+):\\d+:\\d+").unwrap()
.replace_all(&normalized, "SRC_DIR$1:LL:COL").into_owned();
normalized = normalized.replace("\\\\", "\\") // denormalize for paths on windows
.replace("\\", "/") // normalize for paths on windows
.replace("\r\n", "\n") // normalize for linebreaks on windows
.replace("\t", "\\t"); // makes tabs visible
normalized = Self::normalize_platform_differences(&normalized);
normalized = normalized.replace("\t", "\\t"); // makes tabs visible
// Remove test annotations like `//~ ERROR text` from the output,
// since they duplicate actual errors and make the output hard to read.
@ -3164,6 +3162,36 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
normalized
}
/// Normalize output differences across platforms. Generally changes Windows output to be more
/// Unix-like.
///
/// Replaces backslashes in paths with forward slashes, and replaces CRLF line endings
/// with LF.
fn normalize_platform_differences(output: &str) -> String {
lazy_static! {
/// Used to find Windows paths.
///
/// It's not possible to detect paths in the error messages generally, but this is a
/// decent enough heuristic.
static ref PATH_BACKSLASH_RE: Regex = Regex::new(r#"(?x)
(?:
# Match paths that don't include spaces.
(?:\\[\pL\pN\.\-_']+)+\.\pL+
|
# If the path starts with a well-known root, then allow spaces.
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_' ]+)+
)"#
).unwrap();
}
let output = output.replace(r"\\", r"\");
PATH_BACKSLASH_RE.replace_all(&output, |caps: &Captures<'_>| {
println!("{}", &caps[0]);
caps[0].replace(r"\", "/")
}).replace("\r\n", "\n")
}
fn expected_output_path(&self, kind: &str) -> PathBuf {
let mut path = expected_output_path(
&self.testpaths,
@ -3495,3 +3523,68 @@ fn into_bytes(self) -> Vec<u8> {
stderr: stderr.into_bytes(),
})
}
#[cfg(test)]
mod tests {
use super::TestCx;
#[test]
fn normalize_platform_differences() {
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\foo.rs"),
"$DIR/foo.rs"
);
assert_eq!(
TestCx::normalize_platform_differences(r"$BUILD_DIR\..\parser.rs"),
"$BUILD_DIR/../parser.rs"
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\bar.rs hello\nworld"),
r"$DIR/bar.rs hello\nworld"
);
assert_eq!(
TestCx::normalize_platform_differences(r"either bar\baz.rs or bar\baz\mod.rs"),
r"either bar/baz.rs or bar/baz/mod.rs",
);
assert_eq!(
TestCx::normalize_platform_differences(r"`.\some\path.rs`"),
r"`./some/path.rs`",
);
assert_eq!(
TestCx::normalize_platform_differences(r"`some\path.rs`"),
r"`some/path.rs`",
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\path-with-dashes.rs"),
r"$DIR/path-with-dashes.rs"
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\path_with_underscores.rs"),
r"$DIR/path_with_underscores.rs",
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\foo.rs:12:11"), "$DIR/foo.rs:12:11",
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\path with spaces 'n' quotes"),
"$DIR/path with spaces 'n' quotes",
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\file_with\no_extension"),
"$DIR/file_with/no_extension",
);
assert_eq!(TestCx::normalize_platform_differences(r"\n"), r"\n");
assert_eq!(TestCx::normalize_platform_differences(r"{ \n"), r"{ \n");
assert_eq!(TestCx::normalize_platform_differences(r"`\]`"), r"`\]`");
assert_eq!(TestCx::normalize_platform_differences(r#""\{""#), r#""\{""#);
assert_eq!(
TestCx::normalize_platform_differences(r#"write!(&mut v, "Hello\n")"#),
r#"write!(&mut v, "Hello\n")"#
);
assert_eq!(
TestCx::normalize_platform_differences(r#"println!("test\ntest")"#),
r#"println!("test\ntest")"#,
);
}
}