]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/suggest-switching-edition-on-await.rs
Rollup merge of #103570 - lukas-code:stabilize-ilog, r=scottmcm
[rust.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 pass `--edition 2021` to `rustc`
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 pass `--edition 2021` to `rustc`
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 pass `--edition 2021` to `rustc`
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 pass `--edition 2021` to `rustc`
44     //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
45 }