File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments