-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ui test testing the recommendation to use async-trait
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub trait Trait { | ||
async fn method(&self); | ||
} | ||
|
||
pub struct Struct; | ||
|
||
impl Trait for Struct { | ||
async fn method(&self) {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
error[E0706]: functions in traits cannot be declared `async` | ||
--> tests/ui/no-attribute-macro.rs:2:5 | ||
| | ||
2 | async fn method(&self); | ||
| -----^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| `async` because of this | ||
| | ||
= note: `async` trait functions are not currently supported | ||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait | ||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information | ||
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable | ||
|
||
error[E0706]: functions in traits cannot be declared `async` | ||
--> tests/ui/no-attribute-macro.rs:8:5 | ||
| | ||
8 | async fn method(&self) {} | ||
| -----^^^^^^^^^^^^^^^^^ | ||
| | | ||
| `async` because of this | ||
| | ||
= note: `async` trait functions are not currently supported | ||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait | ||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information | ||
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable |