Skip to content

Commit 6d256d9

Browse files
committed
test infra added
1 parent adb15a2 commit 6d256d9

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/ui/parser/issue-113203.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Checks what happens when we attempt to use the await keyword as a prefix. Span
2+
// incorrectly emitted an `.await` in E0277 which does not exist
3+
// edition:2018
4+
fn main() {
5+
await {}()
6+
//~^ ERROR `await` is only allowed inside `async` functions and blocks
7+
//~| ERROR incorrect use of `await`
8+
}

tests/ui/parser/issue-113203.stderr

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error: incorrect use of `await`
2+
--> $DIR/issue-113203.rs:5:5
3+
|
4+
LL | await {}()
5+
| ^^^^^^^^ help: `await` is a postfix operation: `{}.await`
6+
7+
error[E0728]: `await` is only allowed inside `async` functions and blocks
8+
--> $DIR/issue-113203.rs:5:5
9+
|
10+
LL | fn main() {
11+
| ---- this is not `async`
12+
LL | await {}()
13+
| ^^^^^ only allowed inside `async` functions and blocks
14+
15+
error[E0277]: `()` is not a future
16+
--> $DIR/issue-113203.rs:5:5
17+
|
18+
LL | await {}()
19+
| ^^^^^ - help: remove the `.await`
20+
| |
21+
| `()` is not a future
22+
|
23+
= help: the trait `Future` is not implemented for `()`
24+
= note: () must be a future or must implement `IntoFuture` to be awaited
25+
= note: required for `()` to implement `IntoFuture`
26+
27+
error: aborting due to 3 previous errors
28+
29+
Some errors have detailed explanations: E0277, E0728.
30+
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)