-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Strange error message #34359
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This might make it more clear what is going on: fn main() {
for _ in 0 .. 2 {
let x = break;
x(); //~ERROR
}
} |
Another way to get this is What should be the error message here? I am inclined to close unless there is a good idea. |
Well, I can see a few weaknesses in the error message:
|
@eefriedman: In the case the value with the unknown type isn't used, can't rustc just get over it and give it any matching type under the hood? |
I created a patch which changes the error to |
…uggest removing value from `break` when invalid When attempting to use `break` with a value in a type of loop where it'd be invalid (any non-`loop`), suggest using `break` on its own. Close rust-lang#34359.
The following code:
Returns the following error (on all rustc versions):
Which is really strange. The same error occurs with "continue();".
The text was updated successfully, but these errors were encountered: