Skip to content

ICE : non-eager expansion without a parent scope #123911

Closed
@Naserume

Description

@Naserume

Code

macro_rules! m {
    ($attr_path: path) => {
        #[$attr_path]
        fn f() {}
    }
}

m!(inline<{
    let a = CharCharFloat { a: 1 };
    let b = rustrt::rust_dbg_abi_4(a);
    println!("a: {}", b.a);
}>); 

fn main() {}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (a07f3eb43 2024-04-11)
binary: rustc
commit-hash: a07f3eb43acc5df851e15176c7081a900a30a4d7
commit-date: 2024-04-11
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3

Error output

error: unexpected generic arguments in path
  --> ./B141D41129789031369EB5D3F9AB04D118366B0C8AC480C3BED360DCE9E06177.rs:8:10
   |
8  |   m!(inline<{
   |  __________^
9  | |         let a = CharCharFloat { a: 1 };
10 | |         let b = rustrt::rust_dbg_abi_4(a);
11 | |         println!("a: {}", b.a);
12 | | }>); 
   | |__^
Backtrace

thread 'rustc' panicked at compiler/rustc_resolve/src/macros.rs:260:22:
non-eager expansion without a parent scope
stack backtrace:
   0:        0x101c95337 - std::backtrace::Backtrace::create::hdefe7480bc462495
   1:        0x101c95285 - std::backtrace::Backtrace::force_capture::h9596cb6caf0f5f97
   2:        0x10a907442 - std[49a09ef43dd137fc]::panicking::update_hook::<alloc[5c0aec220d3fb6dd]::boxed::Box<rustc_driver_impl[9cc6f343bed42afe]::install_ice_hook::{closure#0}>>::{closure#0}
   3:        0x101caf58c - std::panicking::rust_panic_with_hook::hf0bdb32e38a98365
   4:        0x101caeec4 - std::panicking::begin_panic_handler::{{closure}}::h25f566d6ac4e56a4
   5:        0x101cac2e9 - std::sys_common::backtrace::__rust_end_short_backtrace::hf23f51df86e3880e
   6:        0x101caebf6 - _rust_begin_unwind
   7:        0x101d14195 - core::panicking::panic_fmt::h3ed68d73e880d931
   8:        0x101cf448b - core::panicking::panic_display::h3b62a8882208f86a
   9:        0x101d1415c - core::option::expect_failed::hc769309538e618df
  10:        0x10bf0cf0e - <rustc_resolve[8e0a4e070f7a7f83]::Resolver as rustc_expand[4d7eb586b94f9f6c]::base::ResolverExpand>::resolve_macro_invocation
  11:        0x10aa6445d - <rustc_expand[4d7eb586b94f9f6c]::expand::MacroExpander>::fully_expand_fragment
  12:        0x10aa63da1 - <rustc_expand[4d7eb586b94f9f6c]::expand::MacroExpander>::expand_crate
  13:        0x10b0c10ac - rustc_interface[6612d49bd5b18005]::passes::resolver_for_lowering_raw
  14:        0x10bd5e0b2 - rustc_query_impl[16231b3ed4d194e2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16231b3ed4d194e2]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[86d1f27645b76717]::query::erase::Erased<[u8; 16usize]>>
  15:        0x10bd24a1e - <rustc_query_impl[16231b3ed4d194e2]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[75211c3caa4ba820]::ops::function::FnOnce<(rustc_middle[86d1f27645b76717]::ty::context::TyCtxt, ())>>::call_once
  16:        0x10bb3fda8 - rustc_query_system[acfab0ae1d333eea]::query::plumbing::try_execute_query::<rustc_query_impl[16231b3ed4d194e2]::DynamicConfig<rustc_query_system[acfab0ae1d333eea]::query::caches::SingleCache<rustc_middle[86d1f27645b76717]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[16231b3ed4d194e2]::plumbing::QueryCtxt, false>
  17:        0x10bd65256 - rustc_query_impl[16231b3ed4d194e2]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  18:        0x10a8b994e - <rustc_interface[6612d49bd5b18005]::queries::QueryResult<&rustc_middle[86d1f27645b76717]::ty::context::GlobalCtxt>>::enter::<&rustc_data_structures[25d422f202df6ad4]::steal::Steal<(rustc_middle[86d1f27645b76717]::ty::ResolverAstLowering, alloc[5c0aec220d3fb6dd]::sync::Arc<rustc_ast[2f253e761448c669]::ast::Crate>)>, rustc_driver_impl[9cc6f343bed42afe]::run_compiler::{closure#0}::{closure#1}::{closure#2}>
  19:        0x10a90d7d3 - rustc_interface[6612d49bd5b18005]::interface::run_compiler::<core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>, rustc_driver_impl[9cc6f343bed42afe]::run_compiler::{closure#0}>::{closure#0}
  20:        0x10a8fa2cd - std[49a09ef43dd137fc]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6612d49bd5b18005]::util::run_in_thread_with_globals<rustc_interface[6612d49bd5b18005]::util::run_in_thread_pool_with_globals<rustc_interface[6612d49bd5b18005]::interface::run_compiler<core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>, rustc_driver_impl[9cc6f343bed42afe]::run_compiler::{closure#0}>::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>
  21:        0x10a9143e6 - <<std[49a09ef43dd137fc]::thread::Builder>::spawn_unchecked_<rustc_interface[6612d49bd5b18005]::util::run_in_thread_with_globals<rustc_interface[6612d49bd5b18005]::util::run_in_thread_pool_with_globals<rustc_interface[6612d49bd5b18005]::interface::run_compiler<core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>, rustc_driver_impl[9cc6f343bed42afe]::run_compiler::{closure#0}>::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75211c3caa4ba820]::result::Result<(), rustc_span[c866a394ab29ee91]::ErrorGuaranteed>>::{closure#1} as core[75211c3caa4ba820]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:        0x101cb8ccb - std::sys::pal::unix::thread::Thread::new::thread_start::h6978137b7cf37fba
  23:     0x7ff818270202 - __pthread_start


rustc version: 1.79.0-nightly (a07f3eb43 2024-04-11)
platform: x86_64-apple-darwin

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions