]> git.proxmox.com Git - rustc.git/blob - src/test/ui/async-await/suggest-switching-edition-on-await.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / async-await / suggest-switching-edition-on-await.rs
1 use std::pin::Pin;
2 use std::future::Future;
3
4 fn main() {}
5
6 fn await_on_struct_missing() {
7 struct S;
8 let x = S;
9 x.await;
10 //~^ ERROR no field `await` on type
11 //~| NOTE unknown field
12 //~| NOTE to `.await` a `Future`, switch to Rust 2018
13 //~| HELP set `edition = "2021"` in `Cargo.toml`
14 //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
15 }
16
17 fn await_on_struct_similar() {
18 struct S {
19 awai: u8,
20 }
21 let x = S { awai: 42 };
22 x.await;
23 //~^ ERROR no field `await` on type
24 //~| HELP a field with a similar name exists
25 //~| NOTE to `.await` a `Future`, switch to Rust 2018
26 //~| HELP set `edition = "2021"` in `Cargo.toml`
27 //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
28 }
29
30 fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
31 x.await;
32 //~^ ERROR no field `await` on type
33 //~| NOTE unknown field
34 //~| NOTE to `.await` a `Future`, switch to Rust 2018
35 //~| HELP set `edition = "2021"` in `Cargo.toml`
36 //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
37 }
38
39 fn await_on_apit(x: impl Future<Output = ()>) {
40 x.await;
41 //~^ ERROR no field `await` on type
42 //~| NOTE to `.await` a `Future`, switch to Rust 2018
43 //~| HELP set `edition = "2021"` in `Cargo.toml`
44 //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
45 }