Skip to content

ICE due to invalid assignment in macro: illegal left-hand side expression / capacity overflow / unprintable span #26093

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

Closed
theemathas opened this issue Jun 8, 2015 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@theemathas
Copy link
Contributor

Code:

macro_rules! not_an_lvalue {
    ($thing:expr) => {
        $thing = 42;
    }
}

fn main() {
    not_an_lvalue!(99);
}

playpen

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);
}

playpen

Possibly related issues: #24761, #25793, #25353, #25385

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants