about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-01-01 23:30:34 +0000
committerbors <bors@rust-lang.org>2019-01-01 23:30:34 +0000
commit443ae75eaf86e59da21b75e2e72b7b1dcf2c90e5 (patch)
treed8c9bf088a4fc54c54a77c7c5293c82729bf1205 /src/test
parentb2b7a063af39455d7362524da3123c34c3f4842e (diff)
parent18e0bdae542e2bc5312ab3f27c2864f946609f9a (diff)
downloadrust-443ae75eaf86e59da21b75e2e72b7b1dcf2c90e5.tar.gz
rust-443ae75eaf86e59da21b75e2e72b7b1dcf2c90e5.zip
Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkov
Suggest using raw identifiers in 2018 edition when using keywords
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr4
-rw-r--r--src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr8
-rw-r--r--src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr4
-rw-r--r--src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr8
-rw-r--r--src/test/ui/issues/issue-28433.stderr4
-rw-r--r--src/test/ui/issues/issue-44406.stderr4
-rw-r--r--src/test/ui/issues/issue-57198.stderr4
-rw-r--r--src/test/ui/lifetime_starts_expressions.stderr4
-rw-r--r--src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr4
-rw-r--r--src/test/ui/parser/bad-value-ident-false.stderr4
-rw-r--r--src/test/ui/parser/bad-value-ident-true.stderr4
-rw-r--r--src/test/ui/parser/issue-15980.stderr4
-rw-r--r--src/test/ui/parser/keyword.stderr4
-rw-r--r--src/test/ui/parser/macro-keyword.stderr4
-rw-r--r--src/test/ui/parser/removed-syntax-field-let.stderr4
-rw-r--r--src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr4
-rw-r--r--src/test/ui/rust-2018/dyn-trait-compatibility.stderr4
-rw-r--r--src/test/ui/try-block/try-block-in-edition2015.stderr4
18 files changed, 80 insertions, 0 deletions
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 5dd7030c77e..af1ac19c837 100644
--- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
+++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
@@ -5,6 +5,10 @@ LL |     produces_async! {} //~ ERROR expected identifier, found reserved keywor
    |     ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+help: you can escape reserved keywords to use them as identifiers
+   |
+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 bd49948eb95..52399362482 100644
--- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
@@ -3,12 +3,20 @@ error: expected identifier, found reserved keyword `async`
    |
 LL |     let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async`
    |             ^^^^^ expected identifier, found reserved keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async`
+   |             ^^^^^^^
 
 error: expected identifier, found reserved keyword `async`
   --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13
    |
 LL |     module::async(); //~ ERROR expected identifier, found reserved keyword `async`
    |             ^^^^^ expected identifier, found reserved keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     module::r#async(); //~ ERROR expected identifier, found reserved keyword `async`
+   |             ^^^^^^^
 
 error: no rules expected the token `r#async`
   --> $DIR/edition-keywords-2018-2015-parsing.rs:12: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 44d0e78d06a..d997c3d8a42 100644
--- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
@@ -5,6 +5,10 @@ LL |     produces_async! {} //~ ERROR expected identifier, found reserved keywor
    |     ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+help: you can escape reserved keywords to use them as identifiers
+   |
+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 8e596f743d7..1621368870a 100644
--- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
@@ -3,12 +3,20 @@ error: expected identifier, found reserved keyword `async`
    |
 LL |     let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async`
    |             ^^^^^ expected identifier, found reserved keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async`
+   |             ^^^^^^^
 
 error: expected identifier, found reserved keyword `async`
   --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13
    |
 LL |     module::async(); //~ ERROR expected identifier, found reserved keyword `async`
    |             ^^^^^ expected identifier, found reserved keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     module::r#async(); //~ ERROR expected identifier, found reserved keyword `async`
+   |             ^^^^^^^
 
 error: no rules expected the token `r#async`
   --> $DIR/edition-keywords-2018-2018-parsing.rs:12:31
diff --git a/src/test/ui/issues/issue-28433.stderr b/src/test/ui/issues/issue-28433.stderr
index 97df6db2b52..d3cba3aae71 100644
--- a/src/test/ui/issues/issue-28433.stderr
+++ b/src/test/ui/issues/issue-28433.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `pub`
    |
 LL |     pub duck,
    |     ^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     r#pub duck,
+   |     ^^^^^
 
 error: expected one of `(`, `,`, `=`, `{`, or `}`, found `duck`
   --> $DIR/issue-28433.rs:4:9
diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr
index 45ea586373c..105dbb677dc 100644
--- a/src/test/ui/issues/issue-44406.stderr
+++ b/src/test/ui/issues/issue-44406.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `true`
    |
 LL |     foo!(true); //~ ERROR expected type, found keyword
    |          ^^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     foo!(r#true); //~ ERROR expected type, found keyword
+   |          ^^^^^^
 
 error: expected type, found keyword `true`
   --> $DIR/issue-44406.rs:8:10
diff --git a/src/test/ui/issues/issue-57198.stderr b/src/test/ui/issues/issue-57198.stderr
index c4d297b2d95..2ab552ccbd3 100644
--- a/src/test/ui/issues/issue-57198.stderr
+++ b/src/test/ui/issues/issue-57198.stderr
@@ -3,6 +3,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
+   |
+LL |     m::r#for();
+   |        ^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lifetime_starts_expressions.stderr b/src/test/ui/lifetime_starts_expressions.stderr
index 20efc1fab56..fa0a7ac002b 100644
--- a/src/test/ui/lifetime_starts_expressions.stderr
+++ b/src/test/ui/lifetime_starts_expressions.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `loop`
    |
 LL |     loop { break 'label: loop { break 'label 42; }; }
    |                          ^^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     loop { break 'label: r#loop { break 'label 42; }; }
+   |                          ^^^^^^
 
 error: expected type, found keyword `loop`
   --> $DIR/lifetime_starts_expressions.rs:6:26
diff --git a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr
index 51b1e71a1bb..ceea4625e3e 100644
--- a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr
+++ b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `for`
    |
 LL | fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
    |                     ^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | fn foo2<I>(x: <I as r#for<'x> Foo<&'x isize>>::A)
+   |                     ^^^^^
 
 error: expected one of `::` or `>`, found `Foo`
   --> $DIR/associated-types-project-from-hrtb-explicit.rs:12:29
diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr
index a78437a05f4..1a5c982a43d 100644
--- a/src/test/ui/parser/bad-value-ident-false.stderr
+++ b/src/test/ui/parser/bad-value-ident-false.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `false`
    |
 LL | fn false() { } //~ ERROR expected identifier, found keyword `false`
    |    ^^^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | fn r#false() { } //~ ERROR expected identifier, found keyword `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 948fa4db50e..f431706ccd7 100644
--- a/src/test/ui/parser/bad-value-ident-true.stderr
+++ b/src/test/ui/parser/bad-value-ident-true.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `true`
    |
 LL | fn true() { } //~ ERROR expected identifier, found keyword `true`
    |    ^^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | fn r#true() { } //~ ERROR expected identifier, found keyword `true`
+   |    ^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr
index 748f21016a3..96f3b03dc92 100644
--- a/src/test/ui/parser/issue-15980.stderr
+++ b/src/test/ui/parser/issue-15980.stderr
@@ -6,6 +6,10 @@ LL |         Err(ref e) if e.kind == io::EndOfFile {
 LL |             //~^ NOTE while parsing this struct
 LL |             return
    |             ^^^^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |             r#return
+   |
 
 error: expected one of `.`, `=>`, `?`, or an operator, found `_`
   --> $DIR/issue-15980.rs:15:9
diff --git a/src/test/ui/parser/keyword.stderr b/src/test/ui/parser/keyword.stderr
index d97f6c5ce5a..1c729ff0833 100644
--- a/src/test/ui/parser/keyword.stderr
+++ b/src/test/ui/parser/keyword.stderr
@@ -3,6 +3,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
+   |
+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 0dca30a60d1..d3edb04c119 100644
--- a/src/test/ui/parser/macro-keyword.stderr
+++ b/src/test/ui/parser/macro-keyword.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found reserved keyword `macro`
    |
 LL | fn macro() {  //~ ERROR expected identifier, found reserved keyword `macro`
    |    ^^^^^ expected identifier, found reserved keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | fn r#macro() {  //~ ERROR expected identifier, found reserved keyword `macro`
+   |    ^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/removed-syntax-field-let.stderr b/src/test/ui/parser/removed-syntax-field-let.stderr
index bec50e59664..0d489beae12 100644
--- a/src/test/ui/parser/removed-syntax-field-let.stderr
+++ b/src/test/ui/parser/removed-syntax-field-let.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `let`
    |
 LL |     let foo: (),
    |     ^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     r#let foo: (),
+   |     ^^^^^
 
 error: expected `:`, found `foo`
   --> $DIR/removed-syntax-field-let.rs:4:9
diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr
index 3be31ce9cec..51e1a02cbd7 100644
--- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr
+++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `as`
    |
 LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as`
    |                ^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | use std::any:: r#as foo; //~ ERROR expected identifier, found keyword `as`
+   |                ^^^^
 
 error: expected one of `::`, `;`, or `as`, found `foo`
   --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:19
diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr
index bd72f9c6786..6be00520465 100644
--- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr
+++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr
@@ -3,6 +3,10 @@ error: expected identifier, found keyword `dyn`
    |
 LL | type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn`
    |                ^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | type A1 = dyn::r#dyn; //~ERROR expected identifier, found keyword `dyn`
+   |                ^^^^^
 
 error: expected identifier, found `<`
   --> $DIR/dyn-trait-compatibility.rs:5:14
diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr
index b16aa59090d..63650086bca 100644
--- a/src/test/ui/try-block/try-block-in-edition2015.stderr
+++ b/src/test/ui/try-block/try-block-in-edition2015.stderr
@@ -6,6 +6,10 @@ LL |     let try_result: Option<_> = try {
 LL |     //~^ ERROR expected struct, variant or union type, found macro `try`
 LL |         let x = 5; //~ ERROR expected identifier, found keyword
    |         ^^^ expected identifier, found keyword
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |         r#let x = 5; //~ ERROR expected identifier, found keyword
+   |         ^^^^^
 
 error[E0574]: expected struct, variant or union type, found macro `try`
   --> $DIR/try-block-in-edition2015.rs:4:33