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: node HirId .. cannot be placed in TypeckResults with hir_owner DefId .. #133064

Open
matthiaskrgr opened this issue Nov 15, 2024 · 3 comments
Assignees
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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) ❄️ S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

impl<T>
    Foo<
        T,
        {
            thread_local! { pub static FOO : Foo = Foo { } ; }
        },
    >
{
}

original:

pub struct Foo<T, const N: usize>([T; 0]);

impl<T, const N: usize> Foo<T, {
    thread_local! { pub static FOO : Foo = Foo { } ; }

    #[cfg(cfail2)]
    {
        FOO.with(|_f| ())
    }
}> {
    pub fn new() -> Self {
        Foo([])
    }
}

fn STATIC_NO_MANGLE() {
    let _: Foo<u32, 0> = Foo::new();
}

Version information

rustc 1.84.0-nightly (251dc8ad8 2024-11-15)
binary: rustc
commit-hash: 251dc8ad84492c792a7600d8c5fef2ec868a36a7
commit-date: 2024-11-15
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Possibly related line of code:

}
#[cold]
#[inline(never)]
fn invalid_hir_id_for_typeck_results(hir_owner: OwnerId, hir_id: HirId) {
ty::tls::with(|tcx| {
bug!(
"node {} cannot be placed in TypeckResults with hir_owner {:?}",
tcx.hir().node_to_string(hir_id),
hir_owner
)
});
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0412]: cannot find type `Foo` in this scope
 --> /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:2:5
  |
2 |     Foo<
  |     ^^^ not found in this scope

error[E0412]: cannot find type `Foo` in this scope
 --> /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:5:46
  |
5 |             thread_local! { pub static FOO : Foo = Foo { } ; }
  |                                              ^^^ not found in this scope

error[E0422]: cannot find struct, variant or union type `Foo` in this scope
 --> /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:5:52
  |
5 |             thread_local! { pub static FOO : Foo = Foo { } ; }
  |                                                    ^^^ not found in this scope

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:9:2
  |
9 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs`

error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:552:9: node HirId(DefId(0:5 ~ mvce[00fd]::{impl#0}::FOO).20) (const `{
                                                if $crate::mem::needs_drop::<$t>() {
                                                    |init| {
                                                        #[thread_local]
                                                        static VAL: $crate::thread::local_impl::LazyStorage<$t, ()>
                                                            = $crate::thread::local_impl::LazyStorage::new();
                                                        VAL.get_or_init(init, __init)
                                                    }
                                                } else {
                                                    |init| {
                                                        #[thread_local]
                                                        static VAL: $crate::thread::local_impl::LazyStorage<$t, !>
                                                            = $crate::thread::local_impl::LazyStorage::new();
                                                        VAL.get_or_init(init, __init)
                                                    }
                                                }
                                            }`) cannot be placed in TypeckResults with hir_owner DefId(0:3 ~ mvce[00fd]::{impl#0})

thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:552:9:
Box<dyn Any>
stack backtrace:
   0:     0x784cdba5a3ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3e8890c320687803
   1:     0x784cdc20414a - core::fmt::write::h8e02e323e721d5d3
   2:     0x784cdd62cc51 - std::io::Write::write_fmt::hfa5fc2d5ad51eab4
   3:     0x784cdba5a212 - std::sys::backtrace::BacktraceLock::print::hef9ddff43c45c466
   4:     0x784cdba5c716 - std::panicking::default_hook::{{closure}}::he4ae1ef11715c038
   5:     0x784cdba5c560 - std::panicking::default_hook::h4571154760051e3a
   6:     0x784cdaae4281 - std[575dabc3fc23637d]::panicking::update_hook::<alloc[488fcebc54bee2fb]::boxed::Box<rustc_driver_impl[530468506af41d6d]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x784cdba5ce28 - std::panicking::rust_panic_with_hook::h99e29fee3fbc2974
   8:     0x784cdab1e5d1 - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}
   9:     0x784cdab115a6 - std[575dabc3fc23637d]::sys::backtrace::__rust_end_short_backtrace::<std[575dabc3fc23637d]::panicking::begin_panic<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}, !>
  10:     0x784cdab0ce1d - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>
  11:     0x784cdab282e1 - <rustc_errors[6fe58dffe56bd7e6]::diagnostic::BugAbort as rustc_errors[6fe58dffe56bd7e6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x784cdb1a86d3 - rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt::<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}
  13:     0x784cdb18ef1a - rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt::<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x784cdb18edab - rustc_middle[c94631e3827a547d]::ty::context::tls::with_context_opt::<rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x784cd955b280 - rustc_middle[c94631e3827a547d]::util::bug::bug_fmt
  16:     0x784cdb1a6659 - rustc_middle[c94631e3827a547d]::ty::typeck_results::invalid_hir_id_for_typeck_results
  17:     0x784cdccd6be9 - rustc_mir_build[ce774ae811bc940]::thir::cx::thir_body
  18:     0x784cdccd4ede - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  19:     0x784cdc56f5c9 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  20:     0x784cdc56f1e2 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
  21:     0x784cdccca40f - rustc_mir_build[ce774ae811bc940]::thir::pattern::check_match::check_match
  22:     0x784cdccc9b87 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  23:     0x784cdccc69af - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  24:     0x784cdccc661d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  25:     0x784cdc53620d - rustc_mir_build[ce774ae811bc940]::build::mir_build
  26:     0x784cdc207f04 - rustc_mir_transform[b6a0096f646ee25e]::mir_built
  27:     0x784cdc207ec7 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  28:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  29:     0x784cdc911bcd - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  30:     0x784cdce55ea9 - rustc_mir_transform[b6a0096f646ee25e]::mir_const_qualif
  31:     0x784cdce55da5 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 4usize]>>
  32:     0x784cdce54acf - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::DefIdCache<rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 4usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  33:     0x784cdce54862 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
  34:     0x784cd96f0d14 - rustc_mir_transform[b6a0096f646ee25e]::mir_promoted
  35:     0x784cdc56f2dc - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  36:     0x784cdc56f5b4 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  37:     0x784cdd2cb010 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  38:     0x784cdd2cb106 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  39:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  40:     0x784cdc911b0d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  41:     0x784cdc7456b6 - rustc_interface[c18496298df4cf52]::passes::run_required_analyses
  42:     0x784cdd02961e - rustc_interface[c18496298df4cf52]::passes::analysis
  43:     0x784cdd0295ef - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  44:     0x784cdd1dee6e - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::SingleCache<rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  45:     0x784cdd1deb4e - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x784cdd0d963a - rustc_interface[c18496298df4cf52]::interface::run_compiler::<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}
  47:     0x784cdd132e50 - std[575dabc3fc23637d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>
  48:     0x784cdd13326b - <<std[575dabc3fc23637d]::thread::Builder>::spawn_unchecked_<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#1} as core[678332cb0ee15b78]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x784cdd133d39 - std::sys::pal::unix::thread::Thread::new::thread_start::h1176f996a4a1b888
  50:     0x784cdea2239d - <unknown>
  51:     0x784cdeaa749c - <unknown>
  52:                0x0 - <unknown>

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: rustc 1.84.0-nightly (251dc8ad8 2024-11-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [thir_body] building THIR for `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}`
#1 [check_match] match-checking `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}`
end of query stack
error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:552:9: node HirId(DefId(0:5 ~ mvce[00fd]::{impl#0}::FOO).33) (expr `|init|`) cannot be placed in TypeckResults with hir_owner DefId(0:3 ~ mvce[00fd]::{impl#0})

thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:552:9:
Box<dyn Any>
stack backtrace:
   0:     0x784cdba5a3ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3e8890c320687803
   1:     0x784cdc20414a - core::fmt::write::h8e02e323e721d5d3
   2:     0x784cdd62cc51 - std::io::Write::write_fmt::hfa5fc2d5ad51eab4
   3:     0x784cdba5a212 - std::sys::backtrace::BacktraceLock::print::hef9ddff43c45c466
   4:     0x784cdba5c716 - std::panicking::default_hook::{{closure}}::he4ae1ef11715c038
   5:     0x784cdba5c560 - std::panicking::default_hook::h4571154760051e3a
   6:     0x784cdaae4281 - std[575dabc3fc23637d]::panicking::update_hook::<alloc[488fcebc54bee2fb]::boxed::Box<rustc_driver_impl[530468506af41d6d]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x784cdba5ce28 - std::panicking::rust_panic_with_hook::h99e29fee3fbc2974
   8:     0x784cdab1e5d1 - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}
   9:     0x784cdab115a6 - std[575dabc3fc23637d]::sys::backtrace::__rust_end_short_backtrace::<std[575dabc3fc23637d]::panicking::begin_panic<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}, !>
  10:     0x784cdab0ce1d - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>
  11:     0x784cdab282e1 - <rustc_errors[6fe58dffe56bd7e6]::diagnostic::BugAbort as rustc_errors[6fe58dffe56bd7e6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x784cdb1a86d3 - rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt::<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}
  13:     0x784cdb18ef1a - rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt::<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x784cdb18edab - rustc_middle[c94631e3827a547d]::ty::context::tls::with_context_opt::<rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x784cd955b280 - rustc_middle[c94631e3827a547d]::util::bug::bug_fmt
  16:     0x784cdb1a6659 - rustc_middle[c94631e3827a547d]::ty::typeck_results::invalid_hir_id_for_typeck_results
  17:     0x784cdccd6aca - rustc_mir_build[ce774ae811bc940]::thir::cx::thir_body
  18:     0x784cdccd4ede - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  19:     0x784cdc56f5c9 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  20:     0x784cdc56f1e2 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
  21:     0x784cdccca40f - rustc_mir_build[ce774ae811bc940]::thir::pattern::check_match::check_match
  22:     0x784cdccc9b87 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  23:     0x784cdccc69af - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  24:     0x784cdccc661d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  25:     0x784cdc53620d - rustc_mir_build[ce774ae811bc940]::build::mir_build
  26:     0x784cdc207f04 - rustc_mir_transform[b6a0096f646ee25e]::mir_built
  27:     0x784cdc207ec7 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  28:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  29:     0x784cdc911bcd - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  30:     0x784cdc2463e4 - rustc_mir_transform[b6a0096f646ee25e]::ffi_unwind_calls::has_ffi_unwind_calls
  31:     0x784cdc245dc7 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::has_ffi_unwind_calls::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  32:     0x784cdccc6992 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  33:     0x784cdccc6581 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::has_ffi_unwind_calls::get_query_non_incr::__rust_end_short_backtrace
  34:     0x784cd96f0a12 - rustc_mir_transform[b6a0096f646ee25e]::mir_promoted
  35:     0x784cdc56f2dc - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  36:     0x784cdc56f5b4 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  37:     0x784cdd2cb010 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  38:     0x784cdd2cb106 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  39:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  40:     0x784cdc911b0d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  41:     0x784cdc7456b6 - rustc_interface[c18496298df4cf52]::passes::run_required_analyses
  42:     0x784cdd02961e - rustc_interface[c18496298df4cf52]::passes::analysis
  43:     0x784cdd0295ef - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  44:     0x784cdd1dee6e - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::SingleCache<rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  45:     0x784cdd1deb4e - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x784cdd0d963a - rustc_interface[c18496298df4cf52]::interface::run_compiler::<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}
  47:     0x784cdd132e50 - std[575dabc3fc23637d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>
  48:     0x784cdd13326b - <<std[575dabc3fc23637d]::thread::Builder>::spawn_unchecked_<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#1} as core[678332cb0ee15b78]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x784cdd133d39 - std::sys::pal::unix::thread::Thread::new::thread_start::h1176f996a4a1b888
  50:     0x784cdea2239d - <unknown>
  51:     0x784cdeaa749c - <unknown>
  52:                0x0 - <unknown>

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: rustc 1.84.0-nightly (251dc8ad8 2024-11-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [thir_body] building THIR for `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}::{closure#0}`
#1 [check_match] match-checking `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}::{closure#0}`
end of query stack
error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:552:9: node HirId(DefId(0:5 ~ mvce[00fd]::{impl#0}::FOO).51) (expr `|init|`) cannot be placed in TypeckResults with hir_owner DefId(0:3 ~ mvce[00fd]::{impl#0})

thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:552:9:
Box<dyn Any>
stack backtrace:
   0:     0x784cdba5a3ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3e8890c320687803
   1:     0x784cdc20414a - core::fmt::write::h8e02e323e721d5d3
   2:     0x784cdd62cc51 - std::io::Write::write_fmt::hfa5fc2d5ad51eab4
   3:     0x784cdba5a212 - std::sys::backtrace::BacktraceLock::print::hef9ddff43c45c466
   4:     0x784cdba5c716 - std::panicking::default_hook::{{closure}}::he4ae1ef11715c038
   5:     0x784cdba5c560 - std::panicking::default_hook::h4571154760051e3a
   6:     0x784cdaae4281 - std[575dabc3fc23637d]::panicking::update_hook::<alloc[488fcebc54bee2fb]::boxed::Box<rustc_driver_impl[530468506af41d6d]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x784cdba5ce28 - std::panicking::rust_panic_with_hook::h99e29fee3fbc2974
   8:     0x784cdab1e5d1 - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}
   9:     0x784cdab115a6 - std[575dabc3fc23637d]::sys::backtrace::__rust_end_short_backtrace::<std[575dabc3fc23637d]::panicking::begin_panic<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>::{closure#0}, !>
  10:     0x784cdab0ce1d - std[575dabc3fc23637d]::panicking::begin_panic::<rustc_errors[6fe58dffe56bd7e6]::ExplicitBug>
  11:     0x784cdab282e1 - <rustc_errors[6fe58dffe56bd7e6]::diagnostic::BugAbort as rustc_errors[6fe58dffe56bd7e6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x784cdb1a86d3 - rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt::<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}
  13:     0x784cdb18ef1a - rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt::<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x784cdb18edab - rustc_middle[c94631e3827a547d]::ty::context::tls::with_context_opt::<rustc_middle[c94631e3827a547d]::ty::context::tls::with_opt<rustc_middle[c94631e3827a547d]::util::bug::opt_span_bug_fmt<rustc_span[9778d555244491c7]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x784cd955b280 - rustc_middle[c94631e3827a547d]::util::bug::bug_fmt
  16:     0x784cdb1a6659 - rustc_middle[c94631e3827a547d]::ty::typeck_results::invalid_hir_id_for_typeck_results
  17:     0x784cdccd6aca - rustc_mir_build[ce774ae811bc940]::thir::cx::thir_body
  18:     0x784cdccd4ede - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  19:     0x784cdc56f5c9 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  20:     0x784cdc56f1e2 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
  21:     0x784cdccca40f - rustc_mir_build[ce774ae811bc940]::thir::pattern::check_match::check_match
  22:     0x784cdccc9b87 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  23:     0x784cdccc69af - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  24:     0x784cdccc661d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  25:     0x784cdc53620d - rustc_mir_build[ce774ae811bc940]::build::mir_build
  26:     0x784cdc207f04 - rustc_mir_transform[b6a0096f646ee25e]::mir_built
  27:     0x784cdc207ec7 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  28:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  29:     0x784cdc911bcd - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  30:     0x784cdc2463e4 - rustc_mir_transform[b6a0096f646ee25e]::ffi_unwind_calls::has_ffi_unwind_calls
  31:     0x784cdc245dc7 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::has_ffi_unwind_calls::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  32:     0x784cdccc6992 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  33:     0x784cdccc6581 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::has_ffi_unwind_calls::get_query_non_incr::__rust_end_short_backtrace
  34:     0x784cd96f0a12 - rustc_mir_transform[b6a0096f646ee25e]::mir_promoted
  35:     0x784cdc56f2dc - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>
  36:     0x784cdc56f5b4 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  37:     0x784cdd2cb010 - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  38:     0x784cdd2cb106 - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>
  39:     0x784cdc912001 - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::VecCache<rustc_span[9778d555244491c7]::def_id::LocalDefId, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  40:     0x784cdc911b0d - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  41:     0x784cdc7456b6 - rustc_interface[c18496298df4cf52]::passes::run_required_analyses
  42:     0x784cdd02961e - rustc_interface[c18496298df4cf52]::passes::analysis
  43:     0x784cdd0295ef - rustc_query_impl[bf1c9f3baad9eabf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>
  44:     0x784cdd1dee6e - rustc_query_system[d5846f7a9cb2c23f]::query::plumbing::try_execute_query::<rustc_query_impl[bf1c9f3baad9eabf]::DynamicConfig<rustc_query_system[d5846f7a9cb2c23f]::query::caches::SingleCache<rustc_middle[c94631e3827a547d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bf1c9f3baad9eabf]::plumbing::QueryCtxt, false>
  45:     0x784cdd1deb4e - rustc_query_impl[bf1c9f3baad9eabf]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x784cdd0d963a - rustc_interface[c18496298df4cf52]::interface::run_compiler::<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}
  47:     0x784cdd132e50 - std[575dabc3fc23637d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>
  48:     0x784cdd13326b - <<std[575dabc3fc23637d]::thread::Builder>::spawn_unchecked_<rustc_interface[c18496298df4cf52]::util::run_in_thread_with_globals<rustc_interface[c18496298df4cf52]::util::run_in_thread_pool_with_globals<rustc_interface[c18496298df4cf52]::interface::run_compiler<core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>, rustc_driver_impl[530468506af41d6d]::run_compiler::{closure#0}>::{closure#1}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[678332cb0ee15b78]::result::Result<(), rustc_span[9778d555244491c7]::ErrorGuaranteed>>::{closure#1} as core[678332cb0ee15b78]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x784cdd133d39 - std::sys::pal::unix::thread::Thread::new::thread_start::h1176f996a4a1b888
  50:     0x784cdea2239d - <unknown>
  51:     0x784cdeaa749c - <unknown>
  52:                0x0 - <unknown>

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: rustc 1.84.0-nightly (251dc8ad8 2024-11-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [thir_body] building THIR for `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}::{closure#1}`
#1 [check_match] match-checking `<impl at /tmp/icemaker_global_tempdir.TvQXh8uXlFSu/rustc_testrunner_tmpdir_reporting.SVeSPFzWYhpO/mvce.rs:1:1: 7:6>::FOO::{constant#0}::{constant#0}::{closure#1}`
end of query stack
error: aborting due to 7 previous errors

Some errors have detailed explanations: E0412, E0422, E0601.
For more information about an error, try `rustc --explain E0412`.

@matthiaskrgr matthiaskrgr 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 Nov 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: `node HirId .. cannot be placed in TypeckResults with hir_owner DefId .. ICE: node HirId .. cannot be placed in TypeckResults with hir_owner DefId .. Nov 15, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #132653 cc @BoxyUwU

@cyrgani
Copy link
Contributor

cyrgani commented Nov 15, 2024

reduced:

impl Foo<{thread_local! { }}> {}

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue S-has-bisection Status: a bisection has been found for this issue A-HIR Area: The high-level intermediate representation (HIR) 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 Nov 15, 2024
@BoxyUwU BoxyUwU self-assigned this Nov 15, 2024
@BoxyUwU
Copy link
Member

BoxyUwU commented Nov 21, 2024

Minimized:

macro_rules! empty {
    () => {};
}

struct Foo<const N: usize>;

impl Foo<{ empty!(); }>;

This is caused by the fact that { empty!(); } is represented in the AST as a block expression with no statements, rather than a block expression with one empty statement. This is in contrast to how { ; } is parsed which is as a block expr with one empty statement.

The logic for creating defs for anon consts relies on { foo!(); } actually expanding to a statement rather than nothing at all. If the macro doesn't expand to anything then we never recurse into the expansion and we never create the DefId for the const argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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) ❄️ S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

5 participants