about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Russell <arussell123@gmail.com>2019-03-13 00:47:36 -0400
committerAndy Russell <arussell123@gmail.com>2019-03-25 01:06:45 -0400
commit695dfe7dff89b986d1a5eb551633189338a0af6e (patch)
tree7eba0e5e401ab3c4ce2a2abd07888c468371c86d
parent46914715e2427e376ee9593b62ff8661caadee93 (diff)
downloadrust-695dfe7dff89b986d1a5eb551633189338a0af6e.tar.gz
rust-695dfe7dff89b986d1a5eb551633189338a0af6e.zip
compiletest: make path normalization smarter
-rw-r--r--src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-doc-alias-ice.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-link-span-ice-55723.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-links-warning-crlf.stderr8
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr44
-rw-r--r--src/test/rustdoc-ui/invalid-syntax.stderr22
-rw-r--r--src/test/rustdoc-ui/lint-group.stderr2
-rw-r--r--src/test/ui/cast_char.stderr4
-rw-r--r--src/test/ui/error-codes/E0648.stderr2
-rw-r--r--src/test/ui/fmt/format-string-error-2.stderr50
-rw-r--r--src/test/ui/fmt/format-string-error.stderr6
-rw-r--r--src/test/ui/issues/issue-13727.stderr2
-rw-r--r--src/test/ui/macros/format-foreign.stderr8
-rw-r--r--src/test/ui/macros/macro-backtrace-println.stderr2
-rw-r--r--src/test/ui/parser/ascii-only-character-escape.stderr12
-rw-r--r--src/test/ui/parser/bad-char-literals.stderr6
-rw-r--r--src/test/ui/parser/byte-literals.stderr10
-rw-r--r--src/test/ui/parser/byte-string-literals.stderr8
-rw-r--r--src/test/ui/parser/issue-23620-invalid-escapes.stderr46
-rw-r--r--src/test/ui/parser/issue-43692.stderr2
-rw-r--r--src/test/ui/parser/lex-bad-char-literals-1.stderr12
-rw-r--r--src/test/ui/parser/lex-bad-char-literals-5.stderr8
-rw-r--r--src/test/ui/parser/lex-bad-token.stderr2
-rw-r--r--src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr8
-rw-r--r--src/test/ui/parser/lex-stray-backslash.stderr4
-rw-r--r--src/test/ui/parser/new-unicode-escapes-1.stderr2
-rw-r--r--src/test/ui/parser/new-unicode-escapes-2.stderr2
-rw-r--r--src/test/ui/parser/new-unicode-escapes-3.stderr4
-rw-r--r--src/test/ui/parser/new-unicode-escapes-4.stderr2
-rw-r--r--src/test/ui/parser/raw-byte-string-literals.stderr2
-rw-r--r--src/test/ui/parser/trailing-carriage-return-in-string.stderr4
-rw-r--r--src/test/ui/parser/unicode-chars.stderr2
-rw-r--r--src/test/ui/parser/unicode-quote-chars.stderr2
-rw-r--r--src/test/ui/parser/wrong-escape-of-curly-braces.stderr4
-rw-r--r--src/tools/compiletest/src/runtest.rs103
35 files changed, 247 insertions, 154 deletions
diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
index e0e45d55a9e..1a120dcb186 100644
--- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
+++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
@@ -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
 
diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
index d273ec01975..cebb14cba7c 100644
--- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
+++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
@@ -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
 
diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
index 93c05a0c4dd..7ee9ca47923 100644
--- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
+++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
@@ -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
 
diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
index 62537f2ce2d..8ccc04a4c0b 100644
--- a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
@@ -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 `\]`
 
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index 60fc131dbda..1eec3c57b68 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -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 `\]`
 
diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr
index 10800380a05..b4ed747b44c 100644
--- a/src/test/rustdoc-ui/invalid-syntax.stderr
+++ b/src/test/rustdoc-ui/invalid-syntax.stderr
@@ -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 = "```"]
    | |______________^
    |
diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr
index 76a9133147e..24db3453ec5 100644
--- a/src/test/rustdoc-ui/lint-group.stderr
+++ b/src/test/rustdoc-ui/lint-group.stderr
@@ -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
diff --git a/src/test/ui/cast_char.stderr b/src/test/ui/cast_char.stderr
index 570ca7cba86..f0c9b898890 100644
--- a/src/test/ui/cast_char.stderr
+++ b/src/test/ui/cast_char.stderr
@@ -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
 
diff --git a/src/test/ui/error-codes/E0648.stderr b/src/test/ui/error-codes/E0648.stderr
index f682b4f41e5..1a65825c7b6 100644
--- a/src/test/ui/error-codes/E0648.stderr
+++ b/src/test/ui/error-codes/E0648.stderr
@@ -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
diff --git a/src/test/ui/fmt/format-string-error-2.stderr b/src/test/ui/fmt/format-string-error-2.stderr
index baab8529940..66d35a1b854 100644
--- a/src/test/ui/fmt/format-string-error-2.stderr
+++ b/src/test/ui/fmt/format-string-error-2.stderr
@@ -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 `}}`
diff --git a/src/test/ui/fmt/format-string-error.stderr b/src/test/ui/fmt/format-string-error.stderr
index 86ab163591e..3dc122a7399 100644
--- a/src/test/ui/fmt/format-string-error.stderr
+++ b/src/test/ui/fmt/format-string-error.stderr
@@ -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
diff --git a/src/test/ui/issues/issue-13727.stderr b/src/test/ui/issues/issue-13727.stderr
index 0c2ce9f8b48..4d106651624 100644
--- a/src/test/ui/issues/issue-13727.stderr
+++ b/src/test/ui/issues/issue-13727.stderr
@@ -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
diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr
index 87cadada3c7..e2f2f14dce3 100644
--- a/src/test/ui/macros/format-foreign.stderr
+++ b/src/test/ui/macros/format-foreign.stderr
@@ -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
diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr
index 573184b63b1..209ff09aea4 100644
--- a/src/test/ui/macros/macro-backtrace-println.stderr
+++ b/src/test/ui/macros/macro-backtrace-println.stderr
@@ -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!("{}");
diff --git a/src/test/ui/parser/ascii-only-character-escape.stderr b/src/test/ui/parser/ascii-only-character-escape.stderr
index 7524c4eccd9..8a981e8d62e 100644
--- a/src/test/ui/parser/ascii-only-character-escape.stderr
+++ b/src/test/ui/parser/ascii-only-character-escape.stderr
@@ -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
diff --git a/src/test/ui/parser/bad-char-literals.stderr b/src/test/ui/parser/bad-char-literals.stderr
index eb048b08c71..8e96ea22771 100644
--- a/src/test/ui/parser/bad-char-literals.stderr
+++ b/src/test/ui/parser/bad-char-literals.stderr
@@ -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 |     '    ';
diff --git a/src/test/ui/parser/byte-literals.stderr b/src/test/ui/parser/byte-literals.stderr
index 4edeccfe475..28385f34f2a 100644
--- a/src/test/ui/parser/byte-literals.stderr
+++ b/src/test/ui/parser/byte-literals.stderr
@@ -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'é';
diff --git a/src/test/ui/parser/byte-string-literals.stderr b/src/test/ui/parser/byte-string-literals.stderr
index 45c1a94b519..6701cfd8e66 100644
--- a/src/test/ui/parser/byte-string-literals.stderr
+++ b/src/test/ui/parser/byte-string-literals.stderr
@@ -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"é";
diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issue-23620-invalid-escapes.stderr
index 669a6d26905..295ba3b73e8 100644
--- a/src/test/ui/parser/issue-23620-invalid-escapes.stderr
+++ b/src/test/ui/parser/issue-23620-invalid-escapes.stderr
@@ -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
 
diff --git a/src/test/ui/parser/issue-43692.stderr b/src/test/ui/parser/issue-43692.stderr
index 9408182f952..69a54af3d82 100644
--- a/src/test/ui/parser/issue-43692.stderr
+++ b/src/test/ui/parser/issue-43692.stderr
@@ -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
diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr
index e6b71108086..414ad81512a 100644
--- a/src/test/ui/parser/lex-bad-char-literals-1.stderr
+++ b/src/test/ui/parser/lex-bad-char-literals-1.stderr
@@ -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
diff --git a/src/test/ui/parser/lex-bad-char-literals-5.stderr b/src/test/ui/parser/lex-bad-char-literals-5.stderr
index ef029733101..97c6338820d 100644
--- a/src/test/ui/parser/lex-bad-char-literals-5.stderr
+++ b/src/test/ui/parser/lex-bad-char-literals-5.stderr
@@ -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
diff --git a/src/test/ui/parser/lex-bad-token.stderr b/src/test/ui/parser/lex-bad-token.stderr
index c0c2e542058..43c43721b19 100644
--- a/src/test/ui/parser/lex-bad-token.stderr
+++ b/src/test/ui/parser/lex-bad-token.stderr
@@ -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 | ●
diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
index b4d538bf613..7d944569ca9 100644
--- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
+++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
@@ -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
diff --git a/src/test/ui/parser/lex-stray-backslash.stderr b/src/test/ui/parser/lex-stray-backslash.stderr
index 7ce061b8be0..06dc0f2b537 100644
--- a/src/test/ui/parser/lex-stray-backslash.stderr
+++ b/src/test/ui/parser/lex-stray-backslash.stderr
@@ -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
diff --git a/src/test/ui/parser/new-unicode-escapes-1.stderr b/src/test/ui/parser/new-unicode-escapes-1.stderr
index 5a191735307..a8da50951dd 100644
--- a/src/test/ui/parser/new-unicode-escapes-1.stderr
+++ b/src/test/ui/parser/new-unicode-escapes-1.stderr
@@ -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
diff --git a/src/test/ui/parser/new-unicode-escapes-2.stderr b/src/test/ui/parser/new-unicode-escapes-2.stderr
index 0fb8befa45b..ede49cdf7e1 100644
--- a/src/test/ui/parser/new-unicode-escapes-2.stderr
+++ b/src/test/ui/parser/new-unicode-escapes-2.stderr
@@ -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
diff --git a/src/test/ui/parser/new-unicode-escapes-3.stderr b/src/test/ui/parser/new-unicode-escapes-3.stderr
index 427426788f6..59cfb988f28 100644
--- a/src/test/ui/parser/new-unicode-escapes-3.stderr
+++ b/src/test/ui/parser/new-unicode-escapes-3.stderr
@@ -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
diff --git a/src/test/ui/parser/new-unicode-escapes-4.stderr b/src/test/ui/parser/new-unicode-escapes-4.stderr
index c8dbe027184..ca96b00aa7b 100644
--- a/src/test/ui/parser/new-unicode-escapes-4.stderr
+++ b/src/test/ui/parser/new-unicode-escapes-4.stderr
@@ -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
diff --git a/src/test/ui/parser/raw-byte-string-literals.stderr b/src/test/ui/parser/raw-byte-string-literals.stderr
index 5670ed6590a..a7f1af0a347 100644
--- a/src/test/ui/parser/raw-byte-string-literals.stderr
+++ b/src/test/ui/parser/raw-byte-string-literals.stderr
@@ -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"é";
diff --git a/src/test/ui/parser/trailing-carriage-return-in-string.stderr b/src/test/ui/parser/trailing-carriage-return-in-string.stderr
index f70f8ac8d77..3687b9dd282 100644
--- a/src/test/ui/parser/trailing-carriage-return-in-string.stderr
+++ b/src/test/ui/parser/trailing-carriage-return-in-string.stderr
@@ -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
diff --git a/src/test/ui/parser/unicode-chars.stderr b/src/test/ui/parser/unicode-chars.stderr
index 3a360d8f468..76bf6627a4b 100644
--- a/src/test/ui/parser/unicode-chars.stderr
+++ b/src/test/ui/parser/unicode-chars.stderr
@@ -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;
diff --git a/src/test/ui/parser/unicode-quote-chars.stderr b/src/test/ui/parser/unicode-quote-chars.stderr
index 315e20cf854..4a09ed75605 100644
--- a/src/test/ui/parser/unicode-quote-chars.stderr
+++ b/src/test/ui/parser/unicode-quote-chars.stderr
@@ -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”);
diff --git a/src/test/ui/parser/wrong-escape-of-curly-braces.stderr b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
index 346eba04c65..1406b795ba8 100644
--- a/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
+++ b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
@@ -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 `}}`
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3e3499edf60..22395e3c5bb 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -10,7 +10,7 @@ use crate::errors::{self, Error, ErrorKind};
 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 @@ impl<'test> TestCx<'test> {
         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 @@ impl<'test> TestCx<'test> {
         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 read2_abbreviated(mut child: Child) -> io::Result<Output> {
         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")"#,
+        );
+    }
+}