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
macro_rules! for_else {($i:ident in $iter:expr; $body:tt else $e:expr) => {'outer:loop{for $i in $iter $body
break'outer $e;}};}fnmain(){let result = for_else!(i in 0..10;{break'outer 2.71828;}
else {3.141592});println!("Hello, {}!", result);}
I expected to see this happen: This was a first attempt at a for_else macro, so I'm not sure what I expected! Certainly not an ICE however
Instead, this happened:
Compiling playground v0.0.1 (file:///playground)
error[E0426]: use of undeclared label `'outer`
--> src/main.rs:12:15
|
12 | break 'outer 2.71828;
| ^^^^^^ undeclared label `'outer`
error: internal compiler error: /checkout/src/librustc_typeck/check/mod.rs:1984: no type for node 16: expr 2.71828 (id=16) in fcx 0x7fe29eff3670
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.20.0 (f3d6973f4 2017-08-27) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:489:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Meta
Whatever's running today on the playground.
The text was updated successfully, but these errors were encountered:
In reply to a comment on /r/rust I tried to write a macro to simulate
for ... else
and this causes an ICEI tried this code: playground
I expected to see this happen: This was a first attempt at a
for_else
macro, so I'm not sure what I expected! Certainly not an ICE howeverInstead, this happened:
Meta
Whatever's running today on the playground.
The text was updated successfully, but these errors were encountered: