Skip to content

module name overlap within macros causes ICE #58417

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions