Skip to content

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

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

Closed
Naserume opened this issue Apr 14, 2024 · 0 comments · Fixed by #124318
Closed

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

Naserume opened this issue Apr 14, 2024 · 0 comments · Fixed by #124318
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Naserume
Copy link

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

@Naserume Naserume added 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. labels Apr 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 14, 2024
@jieyouxu jieyouxu added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 18, 2024
@bors bors closed this as completed in 69122f1 May 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 11, 2024
Rollup merge of rust-lang#124318 - bvanjoi:fix-123911, r=petrochenkov

ignore generics args in attribute paths

Fixes rust-lang#97006
Fixes rust-lang#123911
Fixes rust-lang#123912

This patch ensures that we no longer have to handle invalid generic arguments in attribute paths.

r? `@petrochenkov`
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, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants