Skip to content
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

Improve diagnostic for break in async { ... } block #63391

Closed
Centril opened this issue Aug 8, 2019 · 3 comments · Fixed by #63659
Closed

Improve diagnostic for break in async { ... } block #63391

Centril opened this issue Aug 8, 2019 · 3 comments · Fixed by #63659
Assignees
Labels
A-async-await Area: Async & Await A-diagnostics Area: Messages for errors, warnings, and lints AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-enhancement Category: An issue proposing an enhancement or a PR with one. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Centril
Copy link
Contributor

Centril commented Aug 8, 2019

With:

#![feature(async_await)]

fn foo() {
    async {
        break;
    };
}

you get:

error[E0267]: `break` inside of a closure
 --> src/lib.rs:5:9
  |
5 |         break;
  |         ^^^^^ cannot break inside of a closure

Note how it references "a closure" which seems confusing for a user who doesn't presume the implementation.

@Centril Centril added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-async-await Area: Async & Await AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. requires-nightly This issue requires a nightly compiler in some way. labels Aug 8, 2019
@gilescope
Copy link
Contributor

@rustbot claim

@gilescope
Copy link
Contributor

I'm assuming its ok to leave this as the same error code of E0267 - in essence it's the same error, just more specific text.

@Centril
Copy link
Contributor Author

Centril commented Aug 18, 2019

Yeah I think it's fine.

Centril added a commit to Centril/rust that referenced this issue Aug 18, 2019
Improved error message for break in async block

Fixes rust-lang#63391
@bors bors closed this as completed in 4cf7673 Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-diagnostics Area: Messages for errors, warnings, and lints AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-enhancement Category: An issue proposing an enhancement or a PR with one. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants