1
Fork 0
rust/src/test/ui/editions/async-block-2015.rs

31 lines
1.2 KiB
Rust
Raw Normal View History

async fn foo() {
//~^ ERROR `async fn` is not permitted in the 2015 edition
2020-12-30 14:33:46 +01:00
//~| NOTE to use `async fn`, switch to Rust 2018 or later
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
let x = async {};
//~^ ERROR cannot find struct, variant or union type `async` in this scope
//~| NOTE `async` blocks are only allowed in the 2018 edition
2020-12-30 14:33:46 +01:00
let y = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later
let x = 42;
//~^ ERROR expected identifier, found keyword `let`
//~| NOTE expected identifier, found keyword
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
42
};
2020-12-30 14:33:46 +01:00
let z = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later
42
//~^ ERROR expected identifier, found `42`
//~| NOTE expected identifier
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
};
y.await;
z.await;
x
}
fn main() {}