From c8198a608e42e85a9c93fda795a26ea32af5a370 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Thu, 27 Jan 2022 14:53:39 -0800 Subject: [PATCH] Improve suggestion for escaping reserved keywords --- .../rustc_parse/src/parser/diagnostics.rs | 8 +++--- ...edition-error-in-non-macro-position.stderr | 28 +++++++++---------- .../await-keyword/2018-edition-error.stderr | 20 ++++++------- ...dition-keywords-2015-2018-expansion.stderr | 4 +-- .../edition-keywords-2018-2015-parsing.stderr | 8 +++--- ...dition-keywords-2018-2018-expansion.stderr | 4 +-- .../edition-keywords-2018-2018-parsing.stderr | 8 +++--- .../keyword-extern-as-identifier-pat.stderr | 4 +-- .../keyword-extern-as-identifier-use.stderr | 4 +-- .../ui/parser/bad-value-ident-false.stderr | 4 +-- .../ui/parser/bad-value-ident-true.stderr | 4 +-- src/test/ui/parser/issues/issue-15980.stderr | 4 +-- src/test/ui/parser/issues/issue-44406.stderr | 4 +-- src/test/ui/parser/issues/issue-57198.stderr | 4 +-- src/test/ui/parser/issues/issue-81806.stderr | 4 +-- src/test/ui/parser/keyword-abstract.stderr | 4 +-- .../ui/parser/keyword-as-as-identifier.stderr | 4 +-- .../parser/keyword-break-as-identifier.stderr | 4 +-- .../parser/keyword-const-as-identifier.stderr | 4 +-- .../keyword-continue-as-identifier.stderr | 4 +-- .../parser/keyword-else-as-identifier.stderr | 4 +-- .../parser/keyword-enum-as-identifier.stderr | 4 +-- src/test/ui/parser/keyword-final.stderr | 4 +-- .../ui/parser/keyword-fn-as-identifier.stderr | 4 +-- .../parser/keyword-for-as-identifier.stderr | 4 +-- .../ui/parser/keyword-if-as-identifier.stderr | 4 +-- .../parser/keyword-impl-as-identifier.stderr | 4 +-- .../parser/keyword-let-as-identifier.stderr | 4 +-- .../parser/keyword-loop-as-identifier.stderr | 4 +-- .../parser/keyword-match-as-identifier.stderr | 4 +-- .../parser/keyword-mod-as-identifier.stderr | 4 +-- .../parser/keyword-move-as-identifier.stderr | 4 +-- src/test/ui/parser/keyword-override.stderr | 4 +-- .../parser/keyword-pub-as-identifier.stderr | 4 +-- .../keyword-return-as-identifier.stderr | 4 +-- .../keyword-static-as-identifier.stderr | 4 +-- .../keyword-struct-as-identifier.stderr | 4 +-- .../parser/keyword-trait-as-identifier.stderr | 4 +-- ...yword-try-as-identifier-edition2018.stderr | 4 +-- .../parser/keyword-type-as-identifier.stderr | 4 +-- src/test/ui/parser/keyword-typeof.stderr | 4 +-- .../keyword-unsafe-as-identifier.stderr | 4 +-- .../parser/keyword-use-as-identifier.stderr | 4 +-- .../parser/keyword-where-as-identifier.stderr | 4 +-- .../parser/keyword-while-as-identifier.stderr | 4 +-- src/test/ui/parser/keyword.stderr | 4 +-- src/test/ui/parser/macro-keyword.stderr | 4 +-- src/test/ui/parser/mut-patterns.stderr | 12 ++++---- src/test/ui/reserved/reserved-become.stderr | 4 +-- .../rust-2018/dyn-trait-compatibility.stderr | 4 +-- .../raw-name-use-suggestion.stderr | 8 +++--- 51 files changed, 134 insertions(+), 134 deletions(-) diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 17bac362ec81f..7b74b137d21ae 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -192,10 +192,10 @@ impl<'a> Parser<'a> { if ident.is_raw_guess() && self.look_ahead(1, |t| valid_follow.contains(&t.kind)) => { - err.span_suggestion( - ident.span, - "you can escape reserved keywords to use them as identifiers", - format!("r#{}", ident.name), + err.span_suggestion_verbose( + ident.span.shrink_to_lo(), + &format!("escape `{}` to use it as an identifier", ident.name), + "r#".to_owned(), Applicability::MaybeIncorrect, ); } diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr index 56020d1b2f599..ccbaa1f2af0d8 100644 --- a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr +++ b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `await` LL | pub mod await { | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | pub mod r#await { - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:7:20 @@ -15,10 +15,10 @@ error: expected identifier, found keyword `await` LL | pub struct await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | pub struct r#await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:10:22 @@ -26,10 +26,10 @@ error: expected identifier, found keyword `await` LL | use self::outer_mod::await::await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | use self::outer_mod::r#await::await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:10:29 @@ -37,10 +37,10 @@ error: expected identifier, found keyword `await` LL | use self::outer_mod::await::await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | use self::outer_mod::await::r#await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:13:14 @@ -48,10 +48,10 @@ error: expected identifier, found keyword `await` LL | struct Foo { await: () } | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | struct Foo { r#await: () } - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:16:15 @@ -59,10 +59,10 @@ error: expected identifier, found keyword `await` LL | impl Foo { fn await() {} } | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | impl Foo { fn r#await() {} } - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error-in-non-macro-position.rs:19:14 @@ -70,10 +70,10 @@ error: expected identifier, found keyword `await` LL | macro_rules! await { | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | macro_rules! r#await { - | ~~~~~~~ + | ++ error: aborting due to 7 previous errors diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error.stderr index e90cd644457a1..34bfdfc71316e 100644 --- a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr +++ b/src/test/ui/async-await/await-keyword/2018-edition-error.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `await` LL | pub mod await { | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | pub mod r#await { - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error.rs:6:20 @@ -15,10 +15,10 @@ error: expected identifier, found keyword `await` LL | pub struct await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | pub struct r#await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error.rs:9:22 @@ -26,10 +26,10 @@ error: expected identifier, found keyword `await` LL | use self::outer_mod::await::await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | use self::outer_mod::r#await::await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error.rs:9:29 @@ -37,10 +37,10 @@ error: expected identifier, found keyword `await` LL | use self::outer_mod::await::await; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | use self::outer_mod::await::r#await; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/2018-edition-error.rs:12:14 @@ -48,10 +48,10 @@ error: expected identifier, found keyword `await` LL | macro_rules! await { () => {}; } | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | macro_rules! r#await { () => {}; } - | ~~~~~~~ + | ++ error: expected expression, found `)` --> $DIR/2018-edition-error.rs:15:12 diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index 65d9199fa3326..23dad2c16b22c 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -5,10 +5,10 @@ LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword | = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info) -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | () => (pub fn r#async() {}) - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index 837d35bfccb0e..e1eea725bb0b0 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `async` LL | let mut async = 1; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | let mut r#async = 1; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:26:13 @@ -15,10 +15,10 @@ error: expected identifier, found keyword `async` LL | module::async(); | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | module::r#async(); - | ~~~~~~~ + | ++ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2015-parsing.rs:20:31 diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index 77b95ec87a033..67f9aa6041399 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -5,10 +5,10 @@ LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword | = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info) -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | () => (pub fn r#async() {}) - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index 7c183699ac255..0af4da09c19e3 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `async` LL | let mut async = 1; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | let mut r#async = 1; - | ~~~~~~~ + | ++ error: expected identifier, found keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:26:13 @@ -15,10 +15,10 @@ error: expected identifier, found keyword `async` LL | module::async(); | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `async` to use it as an identifier | LL | module::r#async(); - | ~~~~~~~ + | ++ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2018-parsing.rs:20:31 diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr index b3535232f0296..9bf416341e8c3 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `extern` LL | let extern = 0; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `extern` to use it as an identifier | LL | let r#extern = 0; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index a5787d657589d..247d6b0ed7163 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `extern` LL | use extern::foo; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `extern` to use it as an identifier | LL | use r#extern::foo; - | ~~~~~~~~ + | ++ error[E0432]: unresolved import `r#extern` --> $DIR/keyword-extern-as-identifier-use.rs:1:5 diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr index b23322f2c8ced..30c05ecf30a99 100644 --- a/src/test/ui/parser/bad-value-ident-false.stderr +++ b/src/test/ui/parser/bad-value-ident-false.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `false` LL | fn false() { } | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `false` to use it as an identifier | LL | fn r#false() { } - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-true.stderr b/src/test/ui/parser/bad-value-ident-true.stderr index 3eaa6004796cb..74137fa7001ac 100644 --- a/src/test/ui/parser/bad-value-ident-true.stderr +++ b/src/test/ui/parser/bad-value-ident-true.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `true` LL | fn true() { } | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `true` to use it as an identifier | LL | fn r#true() { } - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-15980.stderr b/src/test/ui/parser/issues/issue-15980.stderr index 5cefead2c74d2..c59c811199ea8 100644 --- a/src/test/ui/parser/issues/issue-15980.stderr +++ b/src/test/ui/parser/issues/issue-15980.stderr @@ -7,10 +7,10 @@ LL | LL | return | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `return` to use it as an identifier | LL | r#return - | + | ++ error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_` --> $DIR/issue-15980.rs:13:9 diff --git a/src/test/ui/parser/issues/issue-44406.stderr b/src/test/ui/parser/issues/issue-44406.stderr index 61419040b3381..2f85d8cd8656b 100644 --- a/src/test/ui/parser/issues/issue-44406.stderr +++ b/src/test/ui/parser/issues/issue-44406.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `true` LL | foo!(true); | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `true` to use it as an identifier | LL | foo!(r#true); - | ~~~~~~ + | ++ error: invalid `struct` delimiters or `fn` call arguments --> $DIR/issue-44406.rs:3:9 diff --git a/src/test/ui/parser/issues/issue-57198.stderr b/src/test/ui/parser/issues/issue-57198.stderr index 5a56d80a7d74e..dd70b40224cef 100644 --- a/src/test/ui/parser/issues/issue-57198.stderr +++ b/src/test/ui/parser/issues/issue-57198.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `for` LL | m::for(); | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `for` to use it as an identifier | LL | m::r#for(); - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-81806.stderr b/src/test/ui/parser/issues/issue-81806.stderr index a62c9b0a1aac4..40873388dfb8a 100644 --- a/src/test/ui/parser/issues/issue-81806.stderr +++ b/src/test/ui/parser/issues/issue-81806.stderr @@ -8,10 +8,10 @@ LL | impl LL | } | - the item list ends here | -help: you can escape reserved keywords to use them as identifiers +help: escape `impl` to use it as an identifier | LL | r#impl - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-abstract.stderr b/src/test/ui/parser/keyword-abstract.stderr index 730c5b64b5b7d..b7d1ce7cd7c2b 100644 --- a/src/test/ui/parser/keyword-abstract.stderr +++ b/src/test/ui/parser/keyword-abstract.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `abstract` LL | let abstract = (); | ^^^^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `abstract` to use it as an identifier | LL | let r#abstract = (); - | ~~~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-as-as-identifier.stderr b/src/test/ui/parser/keyword-as-as-identifier.stderr index b9ebdf4b90912..3c5ad950db87a 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.stderr +++ b/src/test/ui/parser/keyword-as-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `as` LL | let as = "foo"; | ^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `as` to use it as an identifier | LL | let r#as = "foo"; - | ~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-break-as-identifier.stderr b/src/test/ui/parser/keyword-break-as-identifier.stderr index 05615b41756b9..a4535eb40a158 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.stderr +++ b/src/test/ui/parser/keyword-break-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `break` LL | let break = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `break` to use it as an identifier | LL | let r#break = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-const-as-identifier.stderr b/src/test/ui/parser/keyword-const-as-identifier.stderr index f7efa53a45e2c..31922f150e538 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.stderr +++ b/src/test/ui/parser/keyword-const-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `const` LL | let const = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `const` to use it as an identifier | LL | let r#const = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-continue-as-identifier.stderr b/src/test/ui/parser/keyword-continue-as-identifier.stderr index aed6be2089967..81285633faa10 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.stderr +++ b/src/test/ui/parser/keyword-continue-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `continue` LL | let continue = "foo"; | ^^^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `continue` to use it as an identifier | LL | let r#continue = "foo"; - | ~~~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-else-as-identifier.stderr b/src/test/ui/parser/keyword-else-as-identifier.stderr index 3fc8af3d154a5..2125fe84aedd4 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.stderr +++ b/src/test/ui/parser/keyword-else-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `else` LL | let else = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `else` to use it as an identifier | LL | let r#else = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-enum-as-identifier.stderr b/src/test/ui/parser/keyword-enum-as-identifier.stderr index 4632814019dab..92d092ccb65b4 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.stderr +++ b/src/test/ui/parser/keyword-enum-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `enum` LL | let enum = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `enum` to use it as an identifier | LL | let r#enum = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-final.stderr b/src/test/ui/parser/keyword-final.stderr index f2edc3fa6b923..f1f9f2e2c90e4 100644 --- a/src/test/ui/parser/keyword-final.stderr +++ b/src/test/ui/parser/keyword-final.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `final` LL | let final = (); | ^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `final` to use it as an identifier | LL | let r#final = (); - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-fn-as-identifier.stderr b/src/test/ui/parser/keyword-fn-as-identifier.stderr index 100295caf6348..645efbcae7136 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.stderr +++ b/src/test/ui/parser/keyword-fn-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `fn` LL | let fn = "foo"; | ^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `fn` to use it as an identifier | LL | let r#fn = "foo"; - | ~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-for-as-identifier.stderr b/src/test/ui/parser/keyword-for-as-identifier.stderr index 312a635cddc2a..26407cc4d3ad2 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.stderr +++ b/src/test/ui/parser/keyword-for-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `for` LL | let for = "foo"; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `for` to use it as an identifier | LL | let r#for = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-if-as-identifier.stderr b/src/test/ui/parser/keyword-if-as-identifier.stderr index 086a77742a7b9..26f9a15a7d00c 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.stderr +++ b/src/test/ui/parser/keyword-if-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `if` LL | let if = "foo"; | ^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `if` to use it as an identifier | LL | let r#if = "foo"; - | ~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-impl-as-identifier.stderr b/src/test/ui/parser/keyword-impl-as-identifier.stderr index a7493d2e60ba5..73a50bc38bcf1 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.stderr +++ b/src/test/ui/parser/keyword-impl-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `impl` LL | let impl = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `impl` to use it as an identifier | LL | let r#impl = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-let-as-identifier.stderr b/src/test/ui/parser/keyword-let-as-identifier.stderr index 456e06dbfaa18..86faaed382f03 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.stderr +++ b/src/test/ui/parser/keyword-let-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `let` LL | let let = "foo"; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `let` to use it as an identifier | LL | let r#let = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-loop-as-identifier.stderr b/src/test/ui/parser/keyword-loop-as-identifier.stderr index c3b33afb4a32d..304ad61ccafc9 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.stderr +++ b/src/test/ui/parser/keyword-loop-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `loop` LL | let loop = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `loop` to use it as an identifier | LL | let r#loop = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-match-as-identifier.stderr b/src/test/ui/parser/keyword-match-as-identifier.stderr index 1ca80dbbd09e4..25ac397fb7e2e 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.stderr +++ b/src/test/ui/parser/keyword-match-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `match` LL | let match = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `match` to use it as an identifier | LL | let r#match = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-mod-as-identifier.stderr b/src/test/ui/parser/keyword-mod-as-identifier.stderr index ea161b004c141..d5688e871b2d7 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mod-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `mod` LL | let mod = "foo"; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `mod` to use it as an identifier | LL | let r#mod = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-move-as-identifier.stderr b/src/test/ui/parser/keyword-move-as-identifier.stderr index 8036cecd791dd..75653cffc13e7 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.stderr +++ b/src/test/ui/parser/keyword-move-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `move` LL | let move = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `move` to use it as an identifier | LL | let r#move = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-override.stderr b/src/test/ui/parser/keyword-override.stderr index 7ae669b27193b..cdb5736866d31 100644 --- a/src/test/ui/parser/keyword-override.stderr +++ b/src/test/ui/parser/keyword-override.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `override` LL | let override = (); | ^^^^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `override` to use it as an identifier | LL | let r#override = (); - | ~~~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-pub-as-identifier.stderr b/src/test/ui/parser/keyword-pub-as-identifier.stderr index df9429a98f0bd..8d513507c810c 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.stderr +++ b/src/test/ui/parser/keyword-pub-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `pub` LL | let pub = "foo"; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `pub` to use it as an identifier | LL | let r#pub = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-return-as-identifier.stderr b/src/test/ui/parser/keyword-return-as-identifier.stderr index 831f557c27a45..eeb8e468ba621 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.stderr +++ b/src/test/ui/parser/keyword-return-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `return` LL | let return = "foo"; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `return` to use it as an identifier | LL | let r#return = "foo"; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-static-as-identifier.stderr b/src/test/ui/parser/keyword-static-as-identifier.stderr index d133e939d3a0d..a3213e2f29740 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.stderr +++ b/src/test/ui/parser/keyword-static-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `static` LL | let static = "foo"; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `static` to use it as an identifier | LL | let r#static = "foo"; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-struct-as-identifier.stderr b/src/test/ui/parser/keyword-struct-as-identifier.stderr index 228ba7c2bc726..b73361a5585d4 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.stderr +++ b/src/test/ui/parser/keyword-struct-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `struct` LL | let struct = "foo"; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `struct` to use it as an identifier | LL | let r#struct = "foo"; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-trait-as-identifier.stderr b/src/test/ui/parser/keyword-trait-as-identifier.stderr index ea90ed3f05e13..56ef5f60690d2 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.stderr +++ b/src/test/ui/parser/keyword-trait-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `trait` LL | let trait = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `trait` to use it as an identifier | LL | let r#trait = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr index 37ba0f27bc241..94a106d47d710 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `try` LL | let try = "foo"; | ^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `try` to use it as an identifier | LL | let r#try = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-type-as-identifier.stderr b/src/test/ui/parser/keyword-type-as-identifier.stderr index 1c49811ae5c84..624c1006b12fc 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.stderr +++ b/src/test/ui/parser/keyword-type-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `type` LL | let type = "foo"; | ^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `type` to use it as an identifier | LL | let r#type = "foo"; - | ~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-typeof.stderr b/src/test/ui/parser/keyword-typeof.stderr index 9fb8ac12db4e4..4c5324505e96a 100644 --- a/src/test/ui/parser/keyword-typeof.stderr +++ b/src/test/ui/parser/keyword-typeof.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `typeof` LL | let typeof = (); | ^^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `typeof` to use it as an identifier | LL | let r#typeof = (); - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr index ddd1bd53083bd..b552c9cd38659 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `unsafe` LL | let unsafe = "foo"; | ^^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `unsafe` to use it as an identifier | LL | let r#unsafe = "foo"; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-use-as-identifier.stderr b/src/test/ui/parser/keyword-use-as-identifier.stderr index 880afb0075f06..630798659a8a4 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.stderr +++ b/src/test/ui/parser/keyword-use-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `use` LL | let use = "foo"; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `use` to use it as an identifier | LL | let r#use = "foo"; - | ~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-where-as-identifier.stderr b/src/test/ui/parser/keyword-where-as-identifier.stderr index 7b6210b712d4f..9e72f7940428c 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.stderr +++ b/src/test/ui/parser/keyword-where-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `where` LL | let where = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `where` to use it as an identifier | LL | let r#where = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-while-as-identifier.stderr b/src/test/ui/parser/keyword-while-as-identifier.stderr index 8f744c3b1ad6f..2bb62105d170e 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.stderr +++ b/src/test/ui/parser/keyword-while-as-identifier.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `while` LL | let while = "foo"; | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `while` to use it as an identifier | LL | let r#while = "foo"; - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/keyword.stderr b/src/test/ui/parser/keyword.stderr index f7692f8c57fe2..ee7d72b3996b7 100644 --- a/src/test/ui/parser/keyword.stderr +++ b/src/test/ui/parser/keyword.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `break` LL | pub mod break { | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `break` to use it as an identifier | LL | pub mod r#break { - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-keyword.stderr b/src/test/ui/parser/macro-keyword.stderr index 22f3ccd0de6fb..d794671f8ab2f 100644 --- a/src/test/ui/parser/macro-keyword.stderr +++ b/src/test/ui/parser/macro-keyword.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `macro` LL | fn macro() { | ^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `macro` to use it as an identifier | LL | fn r#macro() { - | ~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr index 59dba4ae21646..f179d8c9e0a83 100644 --- a/src/test/ui/parser/mut-patterns.stderr +++ b/src/test/ui/parser/mut-patterns.stderr @@ -56,10 +56,10 @@ error: expected identifier, found reserved keyword `yield` LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `yield` to use it as an identifier | LL | let mut mut r#yield(become, await) = r#yield(0, 0); - | ~~~~~~~ + | ++ error: expected identifier, found reserved keyword `become` --> $DIR/mut-patterns.rs:28:23 @@ -67,10 +67,10 @@ error: expected identifier, found reserved keyword `become` LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `become` to use it as an identifier | LL | let mut mut yield(r#become, await) = r#yield(0, 0); - | ~~~~~~~~ + | ++ error: expected identifier, found keyword `await` --> $DIR/mut-patterns.rs:28:31 @@ -78,10 +78,10 @@ error: expected identifier, found keyword `await` LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `await` to use it as an identifier | LL | let mut mut yield(become, r#await) = r#yield(0, 0); - | ~~~~~~~ + | ++ error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:28:9 diff --git a/src/test/ui/reserved/reserved-become.stderr b/src/test/ui/reserved/reserved-become.stderr index 7878efeebe996..0703b76d6de4a 100644 --- a/src/test/ui/reserved/reserved-become.stderr +++ b/src/test/ui/reserved/reserved-become.stderr @@ -4,10 +4,10 @@ error: expected identifier, found reserved keyword `become` LL | let become = 0; | ^^^^^^ expected identifier, found reserved keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `become` to use it as an identifier | LL | let r#become = 0; - | ~~~~~~~~ + | ++ error: aborting due to previous error diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr index 495b06fd2ccff..cf4d6c19cf0b5 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `dyn` LL | type A1 = dyn::dyn; | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `dyn` to use it as an identifier | LL | type A1 = dyn::r#dyn; - | ~~~~~ + | ++ error: expected identifier, found `<` --> $DIR/dyn-trait-compatibility.rs:5:14 diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.stderr b/src/test/ui/suggestions/raw-name-use-suggestion.stderr index bfefc14469835..95c26b9ade8b9 100644 --- a/src/test/ui/suggestions/raw-name-use-suggestion.stderr +++ b/src/test/ui/suggestions/raw-name-use-suggestion.stderr @@ -4,10 +4,10 @@ error: expected identifier, found keyword `break` LL | pub fn break() {} | ^^^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `break` to use it as an identifier | LL | pub fn r#break() {} - | ~~~~~~~ + | ++ error: expected identifier, found keyword `let` --> $DIR/raw-name-use-suggestion.rs:7:10 @@ -15,10 +15,10 @@ error: expected identifier, found keyword `let` LL | foo::let(); | ^^^ expected identifier, found keyword | -help: you can escape reserved keywords to use them as identifiers +help: escape `let` to use it as an identifier | LL | foo::r#let(); - | ~~~~~ + | ++ error[E0425]: cannot find function `r#break` in this scope --> $DIR/raw-name-use-suggestion.rs:8:5