Skip to content

Commit a54d575

Browse files
committed
Add test.
1 parent 22f6448 commit a54d575

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/test/ui/async-await/async-trait-fn.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
trait T {
33
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
44
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
5+
async fn baz() { //~ ERROR functions in traits cannot be declared `async`
6+
// Nested item must not ICE.
7+
fn a() {}
8+
}
59
}
610

711
fn main() {}

src/test/ui/async-await/async-trait-fn.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ LL | async fn bar(&self) {}
2020
= note: `async` trait functions are not currently supported
2121
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
2222

23-
error: aborting due to 2 previous errors
23+
error[E0706]: functions in traits cannot be declared `async`
24+
--> $DIR/async-trait-fn.rs:5:5
25+
|
26+
LL | async fn baz() {
27+
| ^----
28+
| |
29+
| _____`async` because of this
30+
| |
31+
LL | | // Nested item must not ICE.
32+
LL | | fn a() {}
33+
LL | | }
34+
| |_____^
35+
|
36+
= note: `async` trait functions are not currently supported
37+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
38+
39+
error: aborting due to 3 previous errors
2440

2541
For more information about this error, try `rustc --explain E0706`.

0 commit comments

Comments
 (0)