Skip to content

ICE: no entry found for key #145367

@matthiaskrgr

Description

@matthiaskrgr

snippet:

mod m {
    struct Priv2;
}
fn main() {
    WithUse { one: m::Priv2 }
}

Version information

rustc 1.91.0-nightly (350d0ef0e 2025-08-13)
binary: rustc
commit-hash: 350d0ef0ec0493e6d21cfb265cb8211a0e74d766
commit-date: 2025-08-13
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Possibly related line of code:

) {
let Some(expr) = source else { return };
let ast::ExprKind::Struct(struct_expr) = &expr.kind else { return };
// We don't have to handle type-relative paths because they're forbidden in ADT
// expressions, but that would change with `#[feature(more_qualified_paths)]`.
let Some(Res::Def(_, def_id)) =
self.partial_res_map[&struct_expr.path.segments.iter().last().unwrap().id].full_res()
else {
return;
};
let Some(default_fields) = self.field_defaults(def_id) else { return };
if struct_expr.fields.is_empty() {
return;

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

Program output

error[E0422]: cannot find struct, variant or union type `WithUse` in this scope
 --> /tmp/icemaker_global_tempdir.hgrQWhVcL346/rustc_testrunner_tmpdir_reporting.We18CgZLUs4Y/mvce.rs:5:5
  |
5 |     WithUse { one: m::Priv2 }
  |     ^^^^^^^ not found in this scope


thread 'rustc' (2557190) panicked at compiler/rustc_resolve/src/diagnostics.rs:2183:33:
no entry found for key
stack backtrace:
   0:     0x7f7140de5a43 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hff1a9408d012ee89
   1:     0x7f7141601bfc - core::fmt::write::h2f1fc679f228cc52
   2:     0x7f7140dd0493 - std::io::Write::write_fmt::haa2231cbd9aebf95
   3:     0x7f7140de58a2 - std::sys::backtrace::BacktraceLock::print::h28bfdbcac6d3828b
   4:     0x7f7140dc7c1f - std::panicking::default_hook::{{closure}}::h1f968e3a24b0e3b4
   5:     0x7f7140dc774b - std::panicking::default_hook::h43da101644971931
   6:     0x7f713fe491b5 - std[619c96d97fe952c]::panicking::update_hook::<alloc[a5c46f2b217994b5]::boxed::Box<rustc_driver_impl[c8262843f73b2e4e]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f7140dc8313 - std::panicking::panic_with_hook::hb4e916c3e65eccec
   8:     0x7f7140de544a - std::panicking::panic_handler::{{closure}}::hbff715d0475cf1bd
   9:     0x7f7140de53a9 - std::sys::backtrace::__rust_end_short_backtrace::hd6f43484e45a4955
  10:     0x7f7140dc89ed - __rustc[b29d3319de9a3146]::rust_begin_unwind
  11:     0x7f713d4d8890 - core::panicking::panic_fmt::h5f8d281875be5ff1
  12:     0x7f713e5837db - core::option::expect_failed::h7c4e9e1c4059c90a
  13:     0x7f714097278f - <rustc_resolve[c941e31c2824c6c5]::Resolver>::report_privacy_error
  14:     0x7f7141f4535b - <rustc_resolve[c941e31c2824c6c5]::Resolver>::resolve_crate::{closure#0}
  15:     0x7f714217af7f - <rustc_resolve[c941e31c2824c6c5]::Resolver>::resolve_crate
  16:     0x7f7142179269 - rustc_interface[b77c32c3bfe8d9]::passes::configure_and_expand
  17:     0x7f71428b4b2d - rustc_interface[b77c32c3bfe8d9]::passes::resolver_for_lowering_raw
  18:     0x7f71428b488d - rustc_query_impl[e2f117ce3af55616]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e2f117ce3af55616]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ca2e9449305faae]::query::erase::Erased<[u8; 16usize]>>
  19:     0x7f71428b4867 - <rustc_query_impl[e2f117ce3af55616]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[b7f6e7468eb674bd]::ops::function::FnOnce<(rustc_middle[5ca2e9449305faae]::ty::context::TyCtxt, ())>>::call_once
  20:     0x7f71426a765f - rustc_query_system[c907f34f82b7658f]::query::plumbing::try_execute_query::<rustc_query_impl[e2f117ce3af55616]::DynamicConfig<rustc_query_system[c907f34f82b7658f]::query::caches::SingleCache<rustc_middle[5ca2e9449305faae]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e2f117ce3af55616]::plumbing::QueryCtxt, false>
  21:     0x7f71426a71bc - rustc_query_impl[e2f117ce3af55616]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  22:     0x7f714278ecb6 - rustc_interface[b77c32c3bfe8d9]::passes::create_and_enter_global_ctxt::<core[b7f6e7468eb674bd]::option::Option<rustc_interface[b77c32c3bfe8d9]::queries::Linker>, rustc_driver_impl[c8262843f73b2e4e]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  23:     0x7f71427efe03 - rustc_interface[b77c32c3bfe8d9]::interface::run_compiler::<(), rustc_driver_impl[c8262843f73b2e4e]::run_compiler::{closure#0}>::{closure#1}
  24:     0x7f714274e7fb - std[619c96d97fe952c]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b77c32c3bfe8d9]::util::run_in_thread_with_globals<rustc_interface[b77c32c3bfe8d9]::util::run_in_thread_pool_with_globals<rustc_interface[b77c32c3bfe8d9]::interface::run_compiler<(), rustc_driver_impl[c8262843f73b2e4e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  25:     0x7f714274e4d4 - <<std[619c96d97fe952c]::thread::Builder>::spawn_unchecked_<rustc_interface[b77c32c3bfe8d9]::util::run_in_thread_with_globals<rustc_interface[b77c32c3bfe8d9]::util::run_in_thread_pool_with_globals<rustc_interface[b77c32c3bfe8d9]::interface::run_compiler<(), rustc_driver_impl[c8262843f73b2e4e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b7f6e7468eb674bd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7f714274a28b - std::sys::pal::unix::thread::Thread::new::thread_start::h66ff1bba185a50cf
  27:     0x7f713c0a57eb - <unknown>
  28:     0x7f713c12918c - <unknown>
  29:                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: rustc 1.91.0-nightly (350d0ef0e 2025-08-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0422`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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