-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #94708 - notriddle:notriddle/cargo-toml-warning, r=lcnr
diagnostics: only talk about `Cargo.toml` if running under Cargo Fixes #94646
- Loading branch information
Showing
13 changed files
with
132 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/ui/async-await/suggest-switching-edition-on-await-cargo.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// rustc-env:CARGO=/usr/bin/cargo | ||
|
||
use std::pin::Pin; | ||
use std::future::Future; | ||
|
||
fn main() {} | ||
|
||
fn await_on_struct_missing() { | ||
struct S; | ||
let x = S; | ||
x.await; | ||
//~^ ERROR no field `await` on type | ||
//~| NOTE unknown field | ||
//~| NOTE to `.await` a `Future`, switch to Rust 2018 | ||
//~| HELP set `edition = "2021"` in `Cargo.toml` | ||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide | ||
} | ||
|
||
fn await_on_struct_similar() { | ||
struct S { | ||
awai: u8, | ||
} | ||
let x = S { awai: 42 }; | ||
x.await; | ||
//~^ ERROR no field `await` on type | ||
//~| HELP a field with a similar name exists | ||
//~| NOTE to `.await` a `Future`, switch to Rust 2018 | ||
//~| HELP set `edition = "2021"` in `Cargo.toml` | ||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide | ||
} | ||
|
||
fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) { | ||
x.await; | ||
//~^ ERROR no field `await` on type | ||
//~| NOTE unknown field | ||
//~| NOTE to `.await` a `Future`, switch to Rust 2018 | ||
//~| HELP set `edition = "2021"` in `Cargo.toml` | ||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide | ||
} | ||
|
||
fn await_on_apit(x: impl Future<Output = ()>) { | ||
x.await; | ||
//~^ ERROR no field `await` on type | ||
//~| NOTE to `.await` a `Future`, switch to Rust 2018 | ||
//~| HELP set `edition = "2021"` in `Cargo.toml` | ||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide | ||
} |
43 changes: 43 additions & 0 deletions
43
src/test/ui/async-await/suggest-switching-edition-on-await-cargo.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
error[E0609]: no field `await` on type `await_on_struct_missing::S` | ||
--> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7 | ||
| | ||
LL | x.await; | ||
| ^^^^^ unknown field | ||
| | ||
= note: to `.await` a `Future`, switch to Rust 2018 or later | ||
= help: set `edition = "2021"` in `Cargo.toml` | ||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide | ||
|
||
error[E0609]: no field `await` on type `await_on_struct_similar::S` | ||
--> $DIR/suggest-switching-edition-on-await-cargo.rs:24:7 | ||
| | ||
LL | x.await; | ||
| ^^^^^ help: a field with a similar name exists: `awai` | ||
| | ||
= note: to `.await` a `Future`, switch to Rust 2018 or later | ||
= help: set `edition = "2021"` in `Cargo.toml` | ||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide | ||
|
||
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>` | ||
--> $DIR/suggest-switching-edition-on-await-cargo.rs:33:7 | ||
| | ||
LL | x.await; | ||
| ^^^^^ unknown field | ||
| | ||
= note: to `.await` a `Future`, switch to Rust 2018 or later | ||
= help: set `edition = "2021"` in `Cargo.toml` | ||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide | ||
|
||
error[E0609]: no field `await` on type `impl Future<Output = ()>` | ||
--> $DIR/suggest-switching-edition-on-await-cargo.rs:42:7 | ||
| | ||
LL | x.await; | ||
| ^^^^^ | ||
| | ||
= note: to `.await` a `Future`, switch to Rust 2018 or later | ||
= help: set `edition = "2021"` in `Cargo.toml` | ||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0609`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters