Skip to content

ICE: import.imported_module.get().is_none() #144242

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: --edition=2024
#[prelude_import]
use Eq::*;

original:

#[prelude_import] //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
use Eq::*;

fn main(self) {}

Version information

rustc 1.90.0-nightly (e05ab47e6 2025-07-21)
binary: rustc
commit-hash: e05ab47e6c418fb2b9faa2eae9a7e70c65c98eaa
commit-date: 2025-07-21
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8

Possibly related line of code:

suggestion,
module,
segment_name,
..
} => {
if no_ambiguity {
assert!(import.imported_module.get().is_none());
let module = if let Some(ModuleOrUniformRoot::Module(m)) = module {
m.opt_def_id()
} else {
None
};
let err = match self

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024

Program output

error[E0658]: `use` associated items of traits is unstable
 --> /tmp/icemaker_global_tempdir.A5tVAfvjTX4J/rustc_testrunner_tmpdir_reporting.ffmzOMx4u1mM/mvce.rs:2:5
  |
2 | use Eq::*;
  |     ^^^^^
  |
  = note: see issue #134691 <https://github.com/rust-lang/rust/issues/134691> for more information
  = help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
  = note: this compiler was built on 2025-07-21; consider upgrading it if it is out of date


thread 'rustc' panicked at compiler/rustc_resolve/src/imports.rs:996:21:
assertion failed: import.imported_module.get().is_none()
stack backtrace:
   0:     0x7ff26dbaed13 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h085efbd236febcbd
   1:     0x7ff26e402cf7 - core::fmt::write::hdec995910d7cb82c
   2:     0x7ff26dba4983 - std::io::Write::write_fmt::hdeaf768f2514aca6
   3:     0x7ff26dbaeb72 - std::sys::backtrace::BacktraceLock::print::h21329d1cea89715b
   4:     0x7ff26dbb2617 - std::panicking::default_hook::{{closure}}::h2b9a0773f7d3658d
   5:     0x7ff26dbb217b - std::panicking::default_hook::h6914ecce7597b75d
   6:     0x7ff26cc3ce53 - std[c460a2864e85620a]::panicking::update_hook::<alloc[e5e1e0fb3e88a69e]::boxed::Box<rustc_driver_impl[5cdc508988eda417]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7ff26dbb2e5e - std::panicking::rust_panic_with_hook::hda79d560b2103b22
   8:     0x7ff26dbb2b26 - std::panicking::begin_panic_handler::{{closure}}::h11e64d6275db65a6
   9:     0x7ff26dbaf1e9 - std::sys::backtrace::__rust_end_short_backtrace::heaac04fc129e000e
  10:     0x7ff26dbb283d - __rustc[8435b3fdf207ac82]::rust_begin_unwind
  11:     0x7ff26a2caf90 - core::panicking::panic_fmt::h00265bbaa0446d87
  12:     0x7ff26a2e2acc - core::panicking::panic::h030b7fa36d809173
  13:     0x7ff26f08c4f9 - <rustc_resolve[bda850143e33b50b]::Resolver>::resolve_crate::{closure#0}
  14:     0x7ff26f080ed7 - <rustc_resolve[bda850143e33b50b]::Resolver>::resolve_crate
  15:     0x7ff26edda6e9 - rustc_interface[21031aeca52a62ab]::passes::configure_and_expand
  16:     0x7ff26f7116a1 - rustc_interface[21031aeca52a62ab]::passes::resolver_for_lowering_raw
  17:     0x7ff26f71140d - rustc_query_impl[e2149f423b14ff5d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e2149f423b14ff5d]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[966becd38e69f903]::query::erase::Erased<[u8; 16usize]>>
  18:     0x7ff26f7113e7 - <rustc_query_impl[e2149f423b14ff5d]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[66948c5bc5ff115d]::ops::function::FnOnce<(rustc_middle[966becd38e69f903]::ty::context::TyCtxt, ())>>::call_once
  19:     0x7ff26f4dcb47 - rustc_query_system[4d6471456bd701ae]::query::plumbing::try_execute_query::<rustc_query_impl[e2149f423b14ff5d]::DynamicConfig<rustc_query_system[4d6471456bd701ae]::query::caches::SingleCache<rustc_middle[966becd38e69f903]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e2149f423b14ff5d]::plumbing::QueryCtxt, false>
  20:     0x7ff26f4dc6bc - rustc_query_impl[e2149f423b14ff5d]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  21:     0x7ff26f755c76 - rustc_interface[21031aeca52a62ab]::passes::create_and_enter_global_ctxt::<core[66948c5bc5ff115d]::option::Option<rustc_interface[21031aeca52a62ab]::queries::Linker>, rustc_driver_impl[5cdc508988eda417]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  22:     0x7ff26f74389e - rustc_interface[21031aeca52a62ab]::interface::run_compiler::<(), rustc_driver_impl[5cdc508988eda417]::run_compiler::{closure#0}>::{closure#1}
  23:     0x7ff26f60e4b8 - std[c460a2864e85620a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[21031aeca52a62ab]::util::run_in_thread_with_globals<rustc_interface[21031aeca52a62ab]::util::run_in_thread_pool_with_globals<rustc_interface[21031aeca52a62ab]::interface::run_compiler<(), rustc_driver_impl[5cdc508988eda417]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x7ff26f60e196 - <<std[c460a2864e85620a]::thread::Builder>::spawn_unchecked_<rustc_interface[21031aeca52a62ab]::util::run_in_thread_with_globals<rustc_interface[21031aeca52a62ab]::util::run_in_thread_pool_with_globals<rustc_interface[21031aeca52a62ab]::interface::run_compiler<(), rustc_driver_impl[5cdc508988eda417]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[66948c5bc5ff115d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7ff26f61413d - std::sys::pal::unix::thread::Thread::new::thread_start::h2841d6229de09b0b
  26:     0x7ff268e5f7eb - <unknown>
  27:     0x7ff268ee318c - <unknown>
  28:                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.90.0-nightly (e05ab47e6 2025-07-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

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 E0658`.

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) ❄️S-has-bisectionStatus: A bisection has been found for this issueT-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