-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Rust 2018/macro imports/incremental compilation ICE: "thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 3'" #53097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think I have hit the same bug, and I have a minified example. I'm not 100% sure it is the same, but it likely is. It also has two macros with the same name, it seems to ICE in
extern crate pretty_assertions;
use pretty_assertions::assert_eq;
fn a() {
assert_eq!(0, 0);
}
mod m {
fn b() {
assert_eq!(0, 0);
}
mod m1 {
use pretty_assertions::assert_eq;
#[test]
fn c() {
assert_eq!(0, 0, "");
}
}
} This bug is non-deterministic. It sometimes takes me a few tries to make the compiler ICE. To automate this run the following script, which will loop until the ICE:
#!/bin/bash
set -e
while true; do
cargo +nightly clean
cargo +nightly build --all-targets
echo >> src/lib.rs
RUST_BACKTRACE=1 cargo +nightly build --all-targets
done After a few iterations (in my machine it rarely is more than 5 iterations) you should see this:
Note that this bug is also present if you select edition 2015! |
I have a fix for this. Just needs some small changes and then I will open a PR. |
Before this two macros with same name would be indistinguishable inside a `FileName`. This caused a bug in incremental compilation (see rust-lang#53097) since two different macros would map out to the same `StableFilemapId`. Fixes rust-lang#53097.
Before this two macros with same name would be indistinguishable inside a `FileName`. This caused a bug in incremental compilation (see rust-lang#53097) since two different macros would map out to the same `StableFilemapId`. Fixes rust-lang#53097.
Unfortunately, I do not have a clean repro for this bug because it has something to do with macro import conflicts in a small library: two macros named
hlist!
, one infrunk
and another infunky
. I've created a branch with the repro. This crash only happens on incremental compilations. Compilations right aftercargo clean
compile just fine.Repro branch: https://github.com/akiselev/vtable-rs/tree/rustc-index-panic
Reproduce using:
cargo clean && cargo +nightly test
, then change a line of code in the repro (such as commenting out aprintln!
inmod tests
) and runcargo +nightly test
again. The ICE will happen on the second oneOffending code:
core/src/lib.rs
modulestests
andtests2
with modulemacros
Expected result: The code should compile,
funky::hlist!
is only imported in thetests2
module which isn't visible.Error:
The text was updated successfully, but these errors were encountered: