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
Closed

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

Centril opened this issue Aug 8, 2019 · 3 comments

Comments

@Centril
Copy link
Contributor

@Centril 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.

@gilescope
Copy link
Contributor

@gilescope gilescope commented Aug 17, 2019

@rustbot claim

Loading

@gilescope
Copy link
Contributor

@gilescope gilescope commented Aug 18, 2019

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.

Loading

@Centril
Copy link
Contributor Author

@Centril Centril commented Aug 18, 2019

Yeah I think it's fine.

Loading

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 in 4cf7673 Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants