Skip to content

Commit 581f2cb

Browse files
committed
Adjust tests. wrt. await_macro being removed.
1 parent 7589319 commit 581f2cb

11 files changed

+117
-276
lines changed

src/test/ui/async-await/await-keyword/2015-edition-error-in-non-macro-position.rs renamed to src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro)]
1+
#![feature(async_await)]
22
#![allow(non_camel_case_types)]
33
#![deny(keyword_idents)]
44

@@ -29,6 +29,9 @@ macro_rules! await {
2929
}
3030

3131
fn main() {
32+
await!(); //~ ERROR `await` is a keyword in the 2018 edition
33+
//~^ WARN this was previously accepted by the compiler
34+
3235
match await { await => {} } //~ ERROR `await` is a keyword in the 2018 edition
3336
//~^ ERROR `await` is a keyword in the 2018 edition
3437
//~^^ WARN this was previously accepted by the compiler
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: `await` is a keyword in the 2018 edition
2-
--> $DIR/2015-edition-error-in-non-macro-position.rs:6:13
2+
--> $DIR/2015-edition-error-various-positions.rs:6:13
33
|
44
LL | pub mod await {
55
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
66
|
77
note: lint level defined here
8-
--> $DIR/2015-edition-error-in-non-macro-position.rs:3:9
8+
--> $DIR/2015-edition-error-various-positions.rs:3:9
99
|
1010
LL | #![deny(keyword_idents)]
1111
| ^^^^^^^^^^^^^^
1212
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
1313
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
1414

1515
error: `await` is a keyword in the 2018 edition
16-
--> $DIR/2015-edition-error-in-non-macro-position.rs:8:20
16+
--> $DIR/2015-edition-error-various-positions.rs:8:20
1717
|
1818
LL | pub struct await;
1919
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -22,7 +22,7 @@ LL | pub struct await;
2222
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
2323

2424
error: `await` is a keyword in the 2018 edition
25-
--> $DIR/2015-edition-error-in-non-macro-position.rs:12:16
25+
--> $DIR/2015-edition-error-various-positions.rs:12:16
2626
|
2727
LL | use outer_mod::await::await;
2828
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -31,7 +31,7 @@ LL | use outer_mod::await::await;
3131
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
3232

3333
error: `await` is a keyword in the 2018 edition
34-
--> $DIR/2015-edition-error-in-non-macro-position.rs:12:23
34+
--> $DIR/2015-edition-error-various-positions.rs:12:23
3535
|
3636
LL | use outer_mod::await::await;
3737
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -40,7 +40,7 @@ LL | use outer_mod::await::await;
4040
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
4141

4242
error: `await` is a keyword in the 2018 edition
43-
--> $DIR/2015-edition-error-in-non-macro-position.rs:17:14
43+
--> $DIR/2015-edition-error-various-positions.rs:17:14
4444
|
4545
LL | struct Foo { await: () }
4646
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -49,7 +49,7 @@ LL | struct Foo { await: () }
4949
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
5050

5151
error: `await` is a keyword in the 2018 edition
52-
--> $DIR/2015-edition-error-in-non-macro-position.rs:21:15
52+
--> $DIR/2015-edition-error-various-positions.rs:21:15
5353
|
5454
LL | impl Foo { fn await() {} }
5555
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -58,7 +58,7 @@ LL | impl Foo { fn await() {} }
5858
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
5959

6060
error: `await` is a keyword in the 2018 edition
61-
--> $DIR/2015-edition-error-in-non-macro-position.rs:25:14
61+
--> $DIR/2015-edition-error-various-positions.rs:25:14
6262
|
6363
LL | macro_rules! await {
6464
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -67,7 +67,16 @@ LL | macro_rules! await {
6767
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
6868

6969
error: `await` is a keyword in the 2018 edition
70-
--> $DIR/2015-edition-error-in-non-macro-position.rs:32:11
70+
--> $DIR/2015-edition-error-various-positions.rs:32:5
71+
|
72+
LL | await!();
73+
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
74+
|
75+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
76+
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
77+
78+
error: `await` is a keyword in the 2018 edition
79+
--> $DIR/2015-edition-error-various-positions.rs:35:11
7180
|
7281
LL | match await { await => {} }
7382
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -76,13 +85,13 @@ LL | match await { await => {} }
7685
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
7786

7887
error: `await` is a keyword in the 2018 edition
79-
--> $DIR/2015-edition-error-in-non-macro-position.rs:32:19
88+
--> $DIR/2015-edition-error-various-positions.rs:35:19
8089
|
8190
LL | match await { await => {} }
8291
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
8392
|
8493
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
8594
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
8695

87-
error: aborting due to 9 previous errors
96+
error: aborting due to 10 previous errors
8897

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ mod outer_mod {
99
use self::outer_mod::await::await; //~ ERROR expected identifier
1010
//~^ ERROR expected identifier, found reserved keyword `await`
1111

12-
fn main() {}
12+
macro_rules! await { () => {}; } //~ ERROR expected identifier, found reserved keyword `await`
13+
14+
fn main() {
15+
await!(); //~ ERROR expected expression, found `)`
16+
}

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

+17-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,21 @@ help: you can escape reserved keywords to use them as identifiers
3838
LL | use self::outer_mod::await::r#await;
3939
| ^^^^^^^
4040

41-
error: aborting due to 4 previous errors
41+
error: expected identifier, found reserved keyword `await`
42+
--> $DIR/2018-edition-error.rs:12:14
43+
|
44+
LL | macro_rules! await { () => {}; }
45+
| ^^^^^ expected identifier, found reserved keyword
46+
help: you can escape reserved keywords to use them as identifiers
47+
|
48+
LL | macro_rules! r#await { () => {}; }
49+
| ^^^^^^^
50+
51+
error: expected expression, found `)`
52+
--> $DIR/2018-edition-error.rs:15:12
53+
|
54+
LL | await!();
55+
| ^ expected expression
56+
57+
error: aborting due to 6 previous errors
4258

src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs

+25
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,31 @@ fn foo25() -> Result<(), ()> {
104104
foo()
105105
}
106106

107+
async fn foo26() -> Result<(), ()> {
108+
let _ = await!(bar()); //~ ERROR incorrect use of `await`
109+
Ok(())
110+
}
111+
async fn foo27() -> Result<(), ()> {
112+
let _ = await!(bar())?; //~ ERROR incorrect use of `await`
113+
Ok(())
114+
}
115+
fn foo28() -> Result<(), ()> {
116+
fn foo() -> Result<(), ()> {
117+
let _ = await!(bar())?; //~ ERROR incorrect use of `await`
118+
//~^ ERROR `await` is only allowed inside `async` functions
119+
Ok(())
120+
}
121+
foo()
122+
}
123+
fn foo29() -> Result<(), ()> {
124+
let foo = || {
125+
let _ = await!(bar())?; //~ ERROR incorrect use of `await`
126+
//~^ ERROR `await` is only allowed inside `async` functions
127+
Ok(())
128+
};
129+
foo()
130+
}
131+
107132
fn main() {
108133
match await { await => () }
109134
//~^ ERROR expected expression, found `=>`

src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr

+44-4
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,46 @@ error: incorrect use of `await`
8888
LL | let _ = bar().await()?;
8989
| ^^ help: `await` is not a method call, remove the parentheses
9090

91+
error: incorrect use of `await`
92+
--> $DIR/incorrect-syntax-suggestions.rs:108:13
93+
|
94+
LL | let _ = await!(bar());
95+
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
96+
97+
error: incorrect use of `await`
98+
--> $DIR/incorrect-syntax-suggestions.rs:112:13
99+
|
100+
LL | let _ = await!(bar())?;
101+
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
102+
103+
error: incorrect use of `await`
104+
--> $DIR/incorrect-syntax-suggestions.rs:117:17
105+
|
106+
LL | let _ = await!(bar())?;
107+
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
108+
109+
error: incorrect use of `await`
110+
--> $DIR/incorrect-syntax-suggestions.rs:125:17
111+
|
112+
LL | let _ = await!(bar())?;
113+
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
114+
91115
error: expected expression, found `=>`
92-
--> $DIR/incorrect-syntax-suggestions.rs:108:25
116+
--> $DIR/incorrect-syntax-suggestions.rs:133:25
93117
|
94118
LL | match await { await => () }
95119
| ----- ^^ expected expression
96120
| |
97121
| while parsing this incorrect await expression
98122

99123
error: incorrect use of `await`
100-
--> $DIR/incorrect-syntax-suggestions.rs:108:11
124+
--> $DIR/incorrect-syntax-suggestions.rs:133:11
101125
|
102126
LL | match await { await => () }
103127
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`
104128

105129
error: expected one of `.`, `?`, `{`, or an operator, found `}`
106-
--> $DIR/incorrect-syntax-suggestions.rs:111:1
130+
--> $DIR/incorrect-syntax-suggestions.rs:136:1
107131
|
108132
LL | match await { await => () }
109133
| ----- - expected one of `.`, `?`, `{`, or an operator here
@@ -193,6 +217,22 @@ LL | let foo = || {
193217
LL | let _ = bar().await?;
194218
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
195219

220+
error[E0728]: `await` is only allowed inside `async` functions and blocks
221+
--> $DIR/incorrect-syntax-suggestions.rs:117:17
222+
|
223+
LL | fn foo() -> Result<(), ()> {
224+
| --- this is not `async`
225+
LL | let _ = await!(bar())?;
226+
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
227+
228+
error[E0728]: `await` is only allowed inside `async` functions and blocks
229+
--> $DIR/incorrect-syntax-suggestions.rs:125:17
230+
|
231+
LL | let foo = || {
232+
| -- this is not `async`
233+
LL | let _ = await!(bar())?;
234+
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
235+
196236
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
197237
--> $DIR/incorrect-syntax-suggestions.rs:18:19
198238
|
@@ -202,6 +242,6 @@ LL | let _ = await bar()?;
202242
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
203243
= note: required by `std::ops::Try::into_result`
204244

205-
error: aborting due to 29 previous errors
245+
error: aborting due to 35 previous errors
206246

207247
For more information about this error, try `rustc --explain E0277`.

src/test/ui/async-await/await-keyword/post_expansion_error.stderr

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ error: expected expression, found `)`
22
--> $DIR/post_expansion_error.rs:8:12
33
|
44
LL | await!()
5-
| ----- ^ expected expression
6-
| |
7-
| while parsing this await macro call
5+
| ^ expected expression
86

97
error: aborting due to previous error
108

0 commit comments

Comments
 (0)