Skip to content
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

module name overlap within macros causes ICE #58417

Closed
ghost opened this issue Feb 13, 2019 · 1 comment · Fixed by #57908
Closed

module name overlap within macros causes ICE #58417

ghost opened this issue Feb 13, 2019 · 1 comment · Fixed by #57908

Comments

@ghost
Copy link

ghost commented Feb 13, 2019

macro_rules! gen_mod {
    ($mod_name:ident) => {
        mod $mod_name {}
        pub use $mod_name;
    }
}
gen_mod! { A }

fn main() {
    println!("Oh no!");
}
   Compiling playground v0.0.1 (/playground)
thread 'main' panicked at 'byte index 31 is out of bounds of `$mod_name`', src/libcore/str/mod.rs:2092:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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: rustc 1.32.0 (9fda7c223 2019-01-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Playground Link

@petrochenkov
Copy link
Contributor

Fixed on nightly, in #57908.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant