rust/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
429 B
Rust
Raw Normal View History

2022-10-07 16:15:13 +00:00
//@ edition: 2021
//@ check-pass
2022-10-07 16:15:13 +00:00
use std::future::Future;
use std::pin::Pin;
2024-01-18 17:28:37 +00:00
#[allow(async_fn_in_trait)]
pub trait MyTrait {
2022-10-07 16:15:13 +00:00
async fn foo(&self) -> i32;
}
impl MyTrait for i32 {
2024-01-18 17:28:37 +00:00
#[warn(refining_impl_trait)]
2022-10-07 16:15:13 +00:00
fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
2024-01-18 17:28:37 +00:00
//~^ WARN impl trait in impl method signature does not match trait method signature
Box::pin(async { *self })
2022-10-07 16:15:13 +00:00
}
}
fn main() {}