rust/tests/ui/async-await/unnecessary-await.rs

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

40 lines
649 B
Rust
Raw Normal View History

// edition:2018
async fn foo () { }
2021-12-02 17:41:45 -06:00
fn bar() -> impl std::future::Future { async {} }
fn boo() {}
async fn baz() -> std::io::Result<()> {
foo().await;
boo().await; //~ ERROR `()` is not a future
bar().await;
std::io::Result::Ok(())
}
macro_rules! e {
() => {
()
};
}
macro_rules! f {
($expr:expr) => {
$expr.await
//~^ ERROR `()` is not a future
};
}
async fn with_macros() {
e!().await;
//~^ ERROR `()` is not a future
f!(());
}
// Regression test for issue #117014.
async fn desugaring_span_ctxt() {
for x in [] {}.await //~ ERROR `()` is not a future
}
2021-11-16 17:04:15 -06:00
fn main() {}