Skip to content

Commit f6cecce

Browse files
committed
Upgrade async/await to "used" keywords.
1 parent f3c8eba commit f6cecce

17 files changed

+61
-61
lines changed

src/libsyntax_pos/symbol.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ symbols! {
8383
Yield: "yield",
8484

8585
// Edition-specific keywords that are used in stable Rust.
86+
Async: "async", // >= 2018 Edition only
87+
Await: "await", // >= 2018 Edition only
8688
Dyn: "dyn", // >= 2018 Edition only
8789

8890
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
89-
Async: "async", // >= 2018 Edition only
90-
Await: "await", // >= 2018 Edition only
9191
Try: "try", // >= 2018 Edition only
9292

9393
// Special lifetime names
@@ -1088,11 +1088,11 @@ pub mod sym {
10881088

10891089
impl Symbol {
10901090
fn is_used_keyword_2018(self) -> bool {
1091-
self == kw::Dyn
1091+
self >= kw::Async && self <= kw::Dyn
10921092
}
10931093

10941094
fn is_unused_keyword_2018(self) -> bool {
1095-
self >= kw::Async && self <= kw::Try
1095+
self == kw::Try
10961096
}
10971097

10981098
/// Used for sanity checking rustdoc keyword sections.

src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
#![allow(non_camel_case_types)]
44

55
mod outer_mod {
6-
pub mod await { //~ ERROR expected identifier, found reserved keyword `await`
7-
pub struct await; //~ ERROR expected identifier, found reserved keyword `await`
6+
pub mod await { //~ ERROR expected identifier, found keyword `await`
7+
pub struct await; //~ ERROR expected identifier, found keyword `await`
88
}
99
}
10-
use self::outer_mod::await::await; //~ ERROR expected identifier, found reserved keyword `await`
11-
//~^ ERROR expected identifier, found reserved keyword `await`
10+
use self::outer_mod::await::await; //~ ERROR expected identifier, found keyword `await`
11+
//~^ ERROR expected identifier, found keyword `await`
1212

1313
struct Foo { await: () }
14-
//~^ ERROR expected identifier, found reserved keyword `await`
14+
//~^ ERROR expected identifier, found keyword `await`
1515

1616
impl Foo { fn await() {} }
17-
//~^ ERROR expected identifier, found reserved keyword `await`
17+
//~^ ERROR expected identifier, found keyword `await`
1818

1919
macro_rules! await {
20-
//~^ ERROR expected identifier, found reserved keyword `await`
20+
//~^ ERROR expected identifier, found keyword `await`
2121
() => {}
2222
}
2323

src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
error: expected identifier, found reserved keyword `await`
1+
error: expected identifier, found keyword `await`
22
--> $DIR/2018-edition-error-in-non-macro-position.rs:6:13
33
|
44
LL | pub mod await {
5-
| ^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^ expected identifier, found keyword
66
help: you can escape reserved keywords to use them as identifiers
77
|
88
LL | pub mod r#await {
99
| ^^^^^^^
1010

11-
error: expected identifier, found reserved keyword `await`
11+
error: expected identifier, found keyword `await`
1212
--> $DIR/2018-edition-error-in-non-macro-position.rs:7:20
1313
|
1414
LL | pub struct await;
15-
| ^^^^^ expected identifier, found reserved keyword
15+
| ^^^^^ expected identifier, found keyword
1616
help: you can escape reserved keywords to use them as identifiers
1717
|
1818
LL | pub struct r#await;
1919
| ^^^^^^^
2020

21-
error: expected identifier, found reserved keyword `await`
21+
error: expected identifier, found keyword `await`
2222
--> $DIR/2018-edition-error-in-non-macro-position.rs:10:22
2323
|
2424
LL | use self::outer_mod::await::await;
25-
| ^^^^^ expected identifier, found reserved keyword
25+
| ^^^^^ expected identifier, found keyword
2626
help: you can escape reserved keywords to use them as identifiers
2727
|
2828
LL | use self::outer_mod::r#await::await;
2929
| ^^^^^^^
3030

31-
error: expected identifier, found reserved keyword `await`
31+
error: expected identifier, found keyword `await`
3232
--> $DIR/2018-edition-error-in-non-macro-position.rs:10:29
3333
|
3434
LL | use self::outer_mod::await::await;
35-
| ^^^^^ expected identifier, found reserved keyword
35+
| ^^^^^ expected identifier, found keyword
3636
help: you can escape reserved keywords to use them as identifiers
3737
|
3838
LL | use self::outer_mod::await::r#await;
3939
| ^^^^^^^
4040

41-
error: expected identifier, found reserved keyword `await`
41+
error: expected identifier, found keyword `await`
4242
--> $DIR/2018-edition-error-in-non-macro-position.rs:13:14
4343
|
4444
LL | struct Foo { await: () }
45-
| ^^^^^ expected identifier, found reserved keyword
45+
| ^^^^^ expected identifier, found keyword
4646
help: you can escape reserved keywords to use them as identifiers
4747
|
4848
LL | struct Foo { r#await: () }
4949
| ^^^^^^^
5050

51-
error: expected identifier, found reserved keyword `await`
51+
error: expected identifier, found keyword `await`
5252
--> $DIR/2018-edition-error-in-non-macro-position.rs:16:15
5353
|
5454
LL | impl Foo { fn await() {} }
55-
| ^^^^^ expected identifier, found reserved keyword
55+
| ^^^^^ expected identifier, found keyword
5656
help: you can escape reserved keywords to use them as identifiers
5757
|
5858
LL | impl Foo { fn r#await() {} }
5959
| ^^^^^^^
6060

61-
error: expected identifier, found reserved keyword `await`
61+
error: expected identifier, found keyword `await`
6262
--> $DIR/2018-edition-error-in-non-macro-position.rs:19:14
6363
|
6464
LL | macro_rules! await {
65-
| ^^^^^ expected identifier, found reserved keyword
65+
| ^^^^^ expected identifier, found keyword
6666
help: you can escape reserved keywords to use them as identifiers
6767
|
6868
LL | macro_rules! r#await {

src/test/ui/async-await/await-keyword/2018-edition-error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ mod outer_mod {
77
}
88
}
99
use self::outer_mod::await::await; //~ ERROR expected identifier
10-
//~^ ERROR expected identifier, found reserved keyword `await`
10+
//~^ ERROR expected identifier, found keyword `await`
1111

12-
macro_rules! await { () => {}; } //~ ERROR expected identifier, found reserved keyword `await`
12+
macro_rules! await { () => {}; } //~ ERROR expected identifier, found keyword `await`
1313

1414
fn main() {
1515
await!(); //~ ERROR expected expression, found `)`

src/test/ui/async-await/await-keyword/2018-edition-error.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
error: expected identifier, found reserved keyword `await`
1+
error: expected identifier, found keyword `await`
22
--> $DIR/2018-edition-error.rs:5:13
33
|
44
LL | pub mod await {
5-
| ^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^ expected identifier, found keyword
66
help: you can escape reserved keywords to use them as identifiers
77
|
88
LL | pub mod r#await {
99
| ^^^^^^^
1010

11-
error: expected identifier, found reserved keyword `await`
11+
error: expected identifier, found keyword `await`
1212
--> $DIR/2018-edition-error.rs:6:20
1313
|
1414
LL | pub struct await;
15-
| ^^^^^ expected identifier, found reserved keyword
15+
| ^^^^^ expected identifier, found keyword
1616
help: you can escape reserved keywords to use them as identifiers
1717
|
1818
LL | pub struct r#await;
1919
| ^^^^^^^
2020

21-
error: expected identifier, found reserved keyword `await`
21+
error: expected identifier, found keyword `await`
2222
--> $DIR/2018-edition-error.rs:9:22
2323
|
2424
LL | use self::outer_mod::await::await;
25-
| ^^^^^ expected identifier, found reserved keyword
25+
| ^^^^^ expected identifier, found keyword
2626
help: you can escape reserved keywords to use them as identifiers
2727
|
2828
LL | use self::outer_mod::r#await::await;
2929
| ^^^^^^^
3030

31-
error: expected identifier, found reserved keyword `await`
31+
error: expected identifier, found keyword `await`
3232
--> $DIR/2018-edition-error.rs:9:29
3333
|
3434
LL | use self::outer_mod::await::await;
35-
| ^^^^^ expected identifier, found reserved keyword
35+
| ^^^^^ expected identifier, found keyword
3636
help: you can escape reserved keywords to use them as identifiers
3737
|
3838
LL | use self::outer_mod::await::r#await;
3939
| ^^^^^^^
4040

41-
error: expected identifier, found reserved keyword `await`
41+
error: expected identifier, found keyword `await`
4242
--> $DIR/2018-edition-error.rs:12:14
4343
|
4444
LL | macro_rules! await { () => {}; }
45-
| ^^^^^ expected identifier, found reserved keyword
45+
| ^^^^^ expected identifier, found keyword
4646
help: you can escape reserved keywords to use them as identifiers
4747
|
4848
LL | macro_rules! r#await { () => {}; }

src/test/ui/async-await/no-const-async.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
// compile-flags: --crate-type lib
44

55
pub const async fn x() {}
6-
//~^ ERROR expected identifier, found reserved keyword `async`
6+
//~^ ERROR expected identifier, found keyword `async`
77
//~^^ expected `:`, found keyword `fn`

src/test/ui/async-await/no-const-async.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: expected identifier, found reserved keyword `async`
1+
error: expected identifier, found keyword `async`
22
--> $DIR/no-const-async.rs:5:11
33
|
44
LL | pub const async fn x() {}
5-
| ^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^ expected identifier, found keyword
66
help: you can escape reserved keywords to use them as identifiers
77
|
88
LL | pub const r#async fn x() {}

src/test/ui/editions/edition-keywords-2015-2018-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern crate edition_kw_macro_2018;
66

77
mod one_async {
8-
produces_async! {} //~ ERROR expected identifier, found reserved keyword
8+
produces_async! {} //~ ERROR expected identifier, found keyword
99
}
1010
mod two_async {
1111
produces_async_raw! {} // OK

src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: expected identifier, found reserved keyword `async`
1+
error: expected identifier, found keyword `async`
22
--> $DIR/edition-keywords-2015-2018-expansion.rs:8:5
33
|
44
LL | produces_async! {}
5-
| ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
66
|
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88
help: you can escape reserved keywords to use them as identifiers

src/test/ui/editions/edition-keywords-2018-2015-parsing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern crate edition_kw_macro_2015;
66

77
pub fn check_async() {
8-
let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async`
8+
let mut async = 1; //~ ERROR expected identifier, found keyword `async`
99
let mut r#async = 1; // OK
1010

1111
r#async = consumes_async!(async); // OK
@@ -15,6 +15,6 @@ pub fn check_async() {
1515

1616
if passes_ident!(async) == 1 {}
1717
if passes_ident!(r#async) == 1 {} // OK
18-
module::async(); //~ ERROR expected identifier, found reserved keyword `async`
18+
module::async(); //~ ERROR expected identifier, found keyword `async`
1919
module::r#async(); // OK
2020
}

src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
error: expected identifier, found reserved keyword `async`
1+
error: expected identifier, found keyword `async`
22
--> $DIR/edition-keywords-2018-2015-parsing.rs:8:13
33
|
44
LL | let mut async = 1;
5-
| ^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^ expected identifier, found keyword
66
help: you can escape reserved keywords to use them as identifiers
77
|
88
LL | let mut r#async = 1;
99
| ^^^^^^^
1010

11-
error: expected identifier, found reserved keyword `async`
11+
error: expected identifier, found keyword `async`
1212
--> $DIR/edition-keywords-2018-2015-parsing.rs:18:13
1313
|
1414
LL | module::async();
15-
| ^^^^^ expected identifier, found reserved keyword
15+
| ^^^^^ expected identifier, found keyword
1616
help: you can escape reserved keywords to use them as identifiers
1717
|
1818
LL | module::r#async();

src/test/ui/editions/edition-keywords-2018-2018-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern crate edition_kw_macro_2018;
66

77
mod one_async {
8-
produces_async! {} //~ ERROR expected identifier, found reserved keyword `async`
8+
produces_async! {} //~ ERROR expected identifier, found keyword `async`
99
}
1010
mod two_async {
1111
produces_async_raw! {} // OK

src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: expected identifier, found reserved keyword `async`
1+
error: expected identifier, found keyword `async`
22
--> $DIR/edition-keywords-2018-2018-expansion.rs:8:5
33
|
44
LL | produces_async! {}
5-
| ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
66
|
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88
help: you can escape reserved keywords to use them as identifiers

src/test/ui/editions/edition-keywords-2018-2018-parsing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern crate edition_kw_macro_2018;
66

77
pub fn check_async() {
8-
let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async`
8+
let mut async = 1; //~ ERROR expected identifier, found keyword `async`
99
let mut r#async = 1; // OK
1010

1111
r#async = consumes_async!(async); // OK
@@ -15,6 +15,6 @@ pub fn check_async() {
1515

1616
if passes_ident!(async) == 1 {}
1717
if passes_ident!(r#async) == 1 {} // OK
18-
module::async(); //~ ERROR expected identifier, found reserved keyword `async`
18+
module::async(); //~ ERROR expected identifier, found keyword `async`
1919
module::r#async(); // OK
2020
}

src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
error: expected identifier, found reserved keyword `async`
1+
error: expected identifier, found keyword `async`
22
--> $DIR/edition-keywords-2018-2018-parsing.rs:8:13
33
|
44
LL | let mut async = 1;
5-
| ^^^^^ expected identifier, found reserved keyword
5+
| ^^^^^ expected identifier, found keyword
66
help: you can escape reserved keywords to use them as identifiers
77
|
88
LL | let mut r#async = 1;
99
| ^^^^^^^
1010

11-
error: expected identifier, found reserved keyword `async`
11+
error: expected identifier, found keyword `async`
1212
--> $DIR/edition-keywords-2018-2018-parsing.rs:18:13
1313
|
1414
LL | module::async();
15-
| ^^^^^ expected identifier, found reserved keyword
15+
| ^^^^^ expected identifier, found keyword
1616
help: you can escape reserved keywords to use them as identifiers
1717
|
1818
LL | module::r#async();

src/test/ui/parser/mut-patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn main() {
2828
//~| ERROR `mut` must be attached to each individual binding
2929
//~| ERROR expected identifier, found reserved keyword `yield`
3030
//~| ERROR expected identifier, found reserved keyword `become`
31-
//~| ERROR expected identifier, found reserved keyword `await`
31+
//~| ERROR expected identifier, found keyword `await`
3232

3333
struct W<T, U>(T, U);
3434
struct B { f: Box<u8> }

src/test/ui/parser/mut-patterns.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ help: you can escape reserved keywords to use them as identifiers
6262
LL | let mut mut yield(r#become, await) = r#yield(0, 0);
6363
| ^^^^^^^^
6464

65-
error: expected identifier, found reserved keyword `await`
65+
error: expected identifier, found keyword `await`
6666
--> $DIR/mut-patterns.rs:26:31
6767
|
6868
LL | let mut mut yield(become, await) = r#yield(0, 0);
69-
| ^^^^^ expected identifier, found reserved keyword
69+
| ^^^^^ expected identifier, found keyword
7070
help: you can escape reserved keywords to use them as identifiers
7171
|
7272
LL | let mut mut yield(become, r#await) = r#yield(0, 0);

0 commit comments

Comments
 (0)