rust/tests/ui/suggestions/issue-97704.rs

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

20 lines
336 B
Rust
Raw Normal View History

//@ edition:2021
//@ run-rustfix
#![allow(unused)]
use std::future::Future;
async fn foo() -> Result<(), i32> {
func(async { Ok::<_, i32>(()) })?;
//~^ ERROR the `?` operator can only be applied to values that implement `Try`
Ok(())
}
async fn func<T>(fut: impl Future<Output = T>) -> T {
fut.await
}
fn main() {}