You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// https://doc.rust-lang.org/error_codes/E0267.html#![allow(unused)]fnmain(){let w = || {break;};// error: `break` inside of a closure}
I expected to see this happen:
Give error like rustc i.e.,
➜ mahad-testsuite rustc E0267.rs
error[E0267]: `break` inside of a closure
--> E0267.rs:4:14
|
4 | let w = || {break;};// error: `break` inside of a closure
| -- ^^^^^ cannot `break` inside of a closure
| |
| enclosing closure
error: aborting due to previous error
For more information about this error, try `rustc --explain E0267`.
➜ mahad-testsuite ../gccrs-build/gcc/crab1 E0267.rs
E0267.rs:4:14:error: ‘break’ outside of a loop or labeled block [E0268]4 | let w = || {break;};// error: `break` inside of a closure
| ^~~~~
E0267.rs:4:9: fatal error: unable to find lang item: ‘fn_once’
4 | let w = || {break;};// error: `break` inside of a closure
| ^~
compilation terminated.
Meta
What version of Rust GCC were you using, git sha b8268b6.
MahadMuhammad
changed the title
Wrong error when loop keyword used outside loop but inside closuer - [E0267](https://doc.rust-lang.org/error_codes/E0267.html)
Wrong error when loop keyword used outside loop but inside closuer - E0267Jul 19, 2023
And E267 is a special case for closures. So there are two issues - change the existing error code to E0268, and then special case closures and emit E0267 errors
@CohenArthur, I already changed the existing error code to E0268. Here's the PR #2453 I'll try to fix the special case. I opened this issue for fixing the special case ...
MahadMuhammad
changed the title
Wrong error when loop keyword used outside loop but inside closuer - E0267
Wrong error when loop keyword used outside loop but inside closure - E0267Jul 20, 2023
Wrong Error when loop keyword used inside of closure but outside of loop -
E0267
godbolt
I tried this code from
E0267
:I expected to see this happen:
Instead, this happened:
E0268
[E0268] break or continue used outside of loop #2453Meta
The text was updated successfully, but these errors were encountered: