Skip to content

Commit 247c8e7

Browse files
committed
Add ui test testing the recommendation to use async-trait
1 parent 799db66 commit 247c8e7

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tests/ui/no-attribute-macro.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pub trait Trait {
2+
async fn method(&self);
3+
}
4+
5+
pub struct Struct;
6+
7+
impl Trait for Struct {
8+
async fn method(&self) {}
9+
}
10+
11+
fn main() {}

tests/ui/no-attribute-macro.stderr

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0706]: functions in traits cannot be declared `async`
2+
--> tests/ui/no-attribute-macro.rs:2:5
3+
|
4+
2 | async fn method(&self);
5+
| -----^^^^^^^^^^^^^^^^^^
6+
| |
7+
| `async` because of this
8+
|
9+
= note: `async` trait functions are not currently supported
10+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
11+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
12+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
13+
14+
error[E0706]: functions in traits cannot be declared `async`
15+
--> tests/ui/no-attribute-macro.rs:8:5
16+
|
17+
8 | async fn method(&self) {}
18+
| -----^^^^^^^^^^^^^^^^^
19+
| |
20+
| `async` because of this
21+
|
22+
= note: `async` trait functions are not currently supported
23+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
24+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
25+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable

0 commit comments

Comments
 (0)