-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implemented a compiler diagnostic for move async mistake #80160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// run-rustfix | ||
// edition:2018 | ||
|
||
// Regression test for issue 79694 | ||
|
||
fn main() { | ||
let _ = async move { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// run-rustfix | ||
// edition:2018 | ||
|
||
// Regression test for issue 79694 | ||
|
||
fn main() { | ||
let _ = move async { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: the order of `move` and `async` is incorrect | ||
--> $DIR/incorrect-move-async-order-issue-79694.rs:7:13 | ||
| | ||
LL | let _ = move async { }; | ||
| ^^^^^^^^^^ | ||
| | ||
help: try switching the order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should show the correct one rather than try switching the order. I opened a pull request for the order of pub async on function, that shows did you mean xxx yyy, easier to follow compared to 'switching the order'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I requested this wording to remain consistent with other diagnostics. In the suggestion that follows the message, it does show the correct order. I don't mind seeing our wording here change, if you'd like to submit a PR for that, but I'd like to see all of the relevant diagnostics changed for consistency. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But what if there are more than 2 items? Say, |
||
| | ||
LL | let _ = async move { }; | ||
| ^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
Uh oh!
There was an error while loading. Please reload this page.