Suggest async {} for async || {}
Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
This commit is contained in:
parent
25b2f48612
commit
5b475a4618
5 changed files with 34 additions and 17 deletions
|
|
@ -6,6 +6,7 @@ LL | let _ = async || {};
|
|||
|
|
||||
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
|
||||
= help: add `#![feature(async_closure)]` to the crate attributes to enable
|
||||
= help: to use an async block, remove the `||`: `async {`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ fn f4() {
|
|||
}
|
||||
|
||||
fn f5() {
|
||||
async //~ ERROR async closures are unstable
|
||||
async
|
||||
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,15 +39,5 @@ LL | async
|
|||
LL | let x = 0;
|
||||
| ^^^ unexpected token
|
||||
|
||||
error[E0658]: async closures are unstable
|
||||
--> $DIR/block-no-opening-brace.rs:29:5
|
||||
|
|
||||
LL | async
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
|
||||
= help: add `#![feature(async_closure)]` to the crate attributes to enable
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue