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

ICE non-eager expansion without a parent scope #66804

Closed
GuillaumeGomez opened this issue Nov 27, 2019 · 2 comments
Closed

ICE non-eager expansion without a parent scope #66804

GuillaumeGomez opened this issue Nov 27, 2019 · 2 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

When running the following code, the compiler crashes. This bug is reproducible is nightly, beta and stable:

macro_rules! doc_comment {
    ($x:expr) => {
        #[doc = $x]
        extern {}
    };
}

macro_rules! some_macro {
    ($t1: ty) => {
        doc_comment!{format!("{coor}", coor = stringify!($t1)).as_str()}}
}

fn main() {
    some_macro!(u8);
}
@GuillaumeGomez GuillaumeGomez added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Nov 27, 2019
@jonas-schievink
Copy link
Contributor

Backtrace:

thread 'rustc' panicked at 'non-eager expansion without a parent scope', src/libcore/option.rs:1190:5
stack backtrace:
  <snip>
  15: core::option::expect_failed
             at src/libcore/option.rs:1190
  16: rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver>::resolve_macro_invocation
  17: syntax::ext::expand::MacroExpander::fully_expand_fragment
  18: syntax::ext::expand::MacroExpander::expand_crate
  19: rustc_interface::passes::configure_and_expand_inner::{{closure}}
  20: rustc::util::common::time
  21: rustc_interface::passes::configure_and_expand_inner
  22: rustc_interface::passes::configure_and_expand::{{closure}}
  23: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  24: rustc_interface::passes::configure_and_expand
  25: rustc_interface::queries::Query<T>::compute
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::expansion
  27: rustc_interface::interface::run_compiler_in_existing_thread_pool
  28: std::thread::local::LocalKey<T>::with
  29: scoped_tls::ScopedKey<T>::set
  30: syntax::with_globals

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2019
@petrochenkov
Copy link
Contributor

Duplicate of #55414.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants