Skip to content

ICE when using inner proc_macro_attribute on crate root #41322

Closed
@mystor

Description

@mystor

There seems to be an ICE which occurs when using an inner proc_macro_attribute on the crate root.

Reproduction crate: https://github.com/mystor/rustc_ice_15042017

Build log:

mlayzell@mlayzell rustc_ice_15042017
$ rustc --version
rustc 1.18.0-nightly (bbdaad0dc 2017-04-14)

mlayzell@mlayzell rustc_ice_15042017
$ RUST_BACKTRACE=1 cargo build
   Compiling rustc_ice_15042017_macro v0.1.0 (file:///Volumes/Devel/Code/rustc_ice_15042017/rustc_ice_15042017_macro)
   Compiling rustc_ice_15042017 v0.1.0 (file:///Volumes/Devel/Code/rustc_ice_15042017)
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 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:329
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: syntax::ext::expand::MacroExpander::expand_crate
   1: rustc_driver::driver::phase_2_configure_and_expand::{{closure}}
   2: rustc_driver::driver::phase_2_configure_and_expand
   3: rustc_driver::driver::compile_input
   4: rustc_driver::run_compiler
   5: std::panicking::try::do_call
   6: __rust_maybe_catch_panic
   7: <F as alloc::boxed::FnBox<A>>::call_box
   8: std::sys::imp::thread::Thread::new::thread_start
   9: _pthread_body
  10: _pthread_start

error: Could not compile `rustc_ice_15042017`.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions