Closed
Description
Code:
macro_rules! not_an_lvalue {
($thing:expr) => {
$thing = 42;
}
}
fn main() {
not_an_lvalue!(99);
}
Error on stable Rust:
<anon>:8:20: 3:20 error: illegal left-hand side expression [E0070]
error: internal compiler error: unexpected panic
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'capacity overflow', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/option.rs:330
Error on nightly Rust:
<anon>:8:20: 3:20 error: illegal left-hand side expression [E0070]
(internal compiler error: unprintable span)
<anon>:1:1: 5:2 note: in expansion of not_an_lvalue!
<anon>:8:5: 8:24 note: expansion site
<anon>:8:20: 3:20 help: see the detailed explanation for E0070
error: aborting due to previous error
This also causes the same ICE:
macro_rules! not_an_lvalue {
($thing:expr) => {
$thing = 42;
}
}
fn foo() {}
fn main() {
not_an_lvalue!(foo);
}