diff options
| author | bors <bors@rust-lang.org> | 2020-10-01 07:38:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-01 07:38:47 +0000 |
| commit | fc42fb8e70af6ad63998f4bfbf62451551eda073 (patch) | |
| tree | 13a17a2ee45eb37c3e35980dfb9a6cfcaff70ca9 /src/test/ui/async-await | |
| parent | 00730fd0f1df0718f4e0f82298bff3bf1f44a98b (diff) | |
| parent | 1301f43119f8ae564a01abd3fa306e87d635e862 (diff) | |
| download | rust-fc42fb8e70af6ad63998f4bfbf62451551eda073.tar.gz rust-fc42fb8e70af6ad63998f4bfbf62451551eda073.zip | |
Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obk
Overhaul const-checking diagnostics The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed. However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time. There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`. As always, meant to be reviewed commit-by-commit. r? `@oli-obk`
Diffstat (limited to 'src/test/ui/async-await')
| -rw-r--r-- | src/test/ui/async-await/no-const-async.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/async-await/no-const-async.stderr | 12 |
2 files changed, 1 insertions, 12 deletions
diff --git a/src/test/ui/async-await/no-const-async.rs b/src/test/ui/async-await/no-const-async.rs index 57a9f175ca3..b3c59734e03 100644 --- a/src/test/ui/async-await/no-const-async.rs +++ b/src/test/ui/async-await/no-const-async.rs @@ -3,4 +3,3 @@ pub const async fn x() {} //~^ ERROR functions cannot be both `const` and `async` -//~| ERROR `impl Trait` in const fn is unstable diff --git a/src/test/ui/async-await/no-const-async.stderr b/src/test/ui/async-await/no-const-async.stderr index 4e59bb50767..90ec646c8c0 100644 --- a/src/test/ui/async-await/no-const-async.stderr +++ b/src/test/ui/async-await/no-const-async.stderr @@ -7,15 +7,5 @@ LL | pub const async fn x() {} | | `async` because of this | `const` because of this -error[E0723]: `impl Trait` in const fn is unstable - --> $DIR/no-const-async.rs:4:24 - | -LL | pub const async fn x() {} - | ^ - | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0723`. |
