Skip to content

Commit 0183a57

Browse files
committed
readd match await test case
1 parent c616605 commit 0183a57

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,8 @@ fn foo25() -> Result<(), ()> {
104104
foo()
105105
}
106106

107-
fn main() {}
107+
fn main() {
108+
match await { await => () }
109+
//~^ ERROR expected expression, found `=>`
110+
//~| ERROR incorrect use of `await`
111+
} //~ ERROR expected one of `.`, `?`, `{`, or an operator, found `}`

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,31 @@ error: incorrect use of `await`
8888
LL | let _ = bar().await()?;
8989
| ^^ help: `await` is not a method call, remove the parentheses
9090

91+
error: expected expression, found `=>`
92+
--> $DIR/incorrect-syntax-suggestions.rs:108:25
93+
|
94+
LL | match await { await => () }
95+
| ----- ^^ expected expression
96+
| |
97+
| while parsing this incorrect await statement
98+
99+
error: incorrect use of `await`
100+
--> $DIR/incorrect-syntax-suggestions.rs:108:11
101+
|
102+
LL | match await { await => () }
103+
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is not a statement: `{ await => () }.await`
104+
105+
error: expected one of `.`, `?`, `{`, or an operator, found `}`
106+
--> $DIR/incorrect-syntax-suggestions.rs:111:1
107+
|
108+
LL | match await { await => () }
109+
| ----- - expected one of `.`, `?`, `{`, or an operator here
110+
| |
111+
| while parsing this match expression
112+
...
113+
LL | }
114+
| ^ unexpected token
115+
91116
error[E0728]: `await` is only allowed inside `async` functions and blocks
92117
--> $DIR/incorrect-syntax-suggestions.rs:55:13
93118
|
@@ -177,6 +202,6 @@ LL | let _ = await bar()?;
177202
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
178203
= note: required by `std::ops::Try::into_result`
179204

180-
error: aborting due to 26 previous errors
205+
error: aborting due to 29 previous errors
181206

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

0 commit comments

Comments
 (0)