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