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: async closure + macros: no entry found for key #129855

Closed
matthiaskrgr opened this issue Sep 1, 2024 · 2 comments · Fixed by #129858
Closed

ICE: async closure + macros: no entry found for key #129855

matthiaskrgr opened this issue Sep 1, 2024 · 2 comments · Fixed by #129858
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` 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

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 1, 2024

Code

rustc a.rs --edition=2021

fn main() {
    foo(async |who| println!());
}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (1a1cc050d 2024-09-01)
binary: rustc
commit-hash: 1a1cc050d8efc906ede39f444936ade1fdc9c6cb
commit-date: 2024-09-01
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output


Backtrace

thread 'rustc' panicked at compiler/rustc_resolve/src/def_collector.rs:22:80:
no entry found for key
stack backtrace:
   0:     0x7e5030dfeb2a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd80d83efaa4dd6d3
   1:     0x7e5031603157 - core::fmt::write::h4f2fc0d8a4bdbc07
   2:     0x7e503289d211 - std::io::Write::write_fmt::h5570f2f97ed637ef
   3:     0x7e5030e011fb - std::panicking::default_hook::{{closure}}::hbf64d79aec33952e
   4:     0x7e5030e00e6e - std::panicking::default_hook::h80f8634d4a0460dc
   5:     0x7e502ff618a9 - std[5b205b49935b963f]::panicking::update_hook::<alloc[3fe16f20e15296c8]::boxed::Box<rustc_driver_impl[27278ae619702df]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x7e5030e01b17 - std::panicking::rust_panic_with_hook::hac455baedf27b84b
   7:     0x7e5030e017d7 - std::panicking::begin_panic_handler::{{closure}}::h74b00d3d62e32c54
   8:     0x7e5030dfefd9 - std::sys::backtrace::__rust_end_short_backtrace::h2f66223c63f26658
   9:     0x7e5030e014a4 - rust_begin_unwind
  10:     0x7e502dcb1353 - core::panicking::panic_fmt::h24235a787e7638f5
  11:     0x7e502ece4c7b - core::option::expect_failed::h5184db463884e9dc
  12:     0x7e5032c30bde - <rustc_resolve[e48d1144e0350ce0]::Resolver as rustc_expand[4329655d59297bef]::base::ResolverExpand>::visit_ast_fragment_with_placeholders.cold
  13:     0x7e502dacaee2 - <rustc_expand[4329655d59297bef]::expand::MacroExpander>::fully_expand_fragment
  14:     0x7e5032786acd - <rustc_expand[4329655d59297bef]::expand::MacroExpander>::expand_crate
  15:     0x7e5031b11691 - rustc_interface[561bcd00c1a26bfb]::passes::resolver_for_lowering_raw
  16:     0x7e5031b10c2b - rustc_query_impl[fe4fa3b217236eb9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fe4fa3b217236eb9]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fdfbfe13c471c215]::query::erase::Erased<[u8; 16usize]>>
  17:     0x7e5031b10c19 - <rustc_query_impl[fe4fa3b217236eb9]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[42bb5247f35782d4]::ops::function::FnOnce<(rustc_middle[fdfbfe13c471c215]::ty::context::TyCtxt, ())>>::call_once
  18:     0x7e5032595512 - rustc_query_system[3d9d5510fbe37373]::query::plumbing::try_execute_query::<rustc_query_impl[fe4fa3b217236eb9]::DynamicConfig<rustc_query_system[3d9d5510fbe37373]::query::caches::SingleCache<rustc_middle[fdfbfe13c471c215]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[fe4fa3b217236eb9]::plumbing::QueryCtxt, false>
  19:     0x7e50325951ad - rustc_query_impl[fe4fa3b217236eb9]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  20:     0x7e50323c95e2 - rustc_interface[561bcd00c1a26bfb]::interface::run_compiler::<core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>, rustc_driver_impl[27278ae619702df]::run_compiler::{closure#0}>::{closure#1}
  21:     0x7e5032473dd0 - std[5b205b49935b963f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[561bcd00c1a26bfb]::util::run_in_thread_with_globals<rustc_interface[561bcd00c1a26bfb]::util::run_in_thread_pool_with_globals<rustc_interface[561bcd00c1a26bfb]::interface::run_compiler<core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>, rustc_driver_impl[27278ae619702df]::run_compiler::{closure#0}>::{closure#1}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>::{closure#0}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>
  22:     0x7e503247443a - <<std[5b205b49935b963f]::thread::Builder>::spawn_unchecked_<rustc_interface[561bcd00c1a26bfb]::util::run_in_thread_with_globals<rustc_interface[561bcd00c1a26bfb]::util::run_in_thread_pool_with_globals<rustc_interface[561bcd00c1a26bfb]::interface::run_compiler<core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>, rustc_driver_impl[27278ae619702df]::run_compiler::{closure#0}>::{closure#1}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>::{closure#0}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[42bb5247f35782d4]::result::Result<(), rustc_span[682bbc8ac5595dcb]::ErrorGuaranteed>>::{closure#1} as core[42bb5247f35782d4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  23:     0x7e50324747ab - std::sys::pal::unix::thread::Thread::new::thread_start::h59b1848733925366
  24:     0x7e5033be039d - <unknown>
  25:     0x7e5033c6549c - <unknown>
  26:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/2/rustc-ice-2024-09-01T14_42_51-1228455.txt` to your bug report

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

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` labels Sep 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 1, 2024
@matthiaskrgr
Copy link
Member Author

#129493 cc @cjgillot

@matthiaskrgr matthiaskrgr changed the title ICE: async closure: no entry found for key ICE: async closure + macros: no entry found for key Sep 1, 2024
@matthiaskrgr matthiaskrgr added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Sep 1, 2024
@compiler-errors
Copy link
Member

I found the bug

@rustbot claim

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 1, 2024
Replace walk with visit so we dont skip outermost expr kind in def collector

This affects async closures with macros as their body expr. Fixes rust-lang#129855.

r? `@cjgillot` or anyone else
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 1, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 2, 2024
Replace walk with visit so we dont skip outermost expr kind in def collector

This affects async closures with macros as their body expr. Fixes rust-lang#129855.

r? ```@cjgillot``` or anyone else
@bors bors closed this as completed in 38b6a66 Sep 2, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 2, 2024
Rollup merge of rust-lang#129858 - compiler-errors:async-def, r=cjgillot

Replace walk with visit so we dont skip outermost expr kind in def collector

This affects async closures with macros as their body expr. Fixes rust-lang#129855.

r? ``@cjgillot`` or anyone else
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. F-async_closure `#![feature(async_closure)]` 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

Successfully merging a pull request may close this issue.

4 participants