Skip to content

[ICE]: import.imported_module.get().is_none() #152895

@cushionbadak

Description

@cushionbadak

Code

#[foobar]
extern crate core as std;

mod inner {
    use crate::*;
    use std::vec::IntoIter;
}

fn main() {}

A mutant of tests/ui/resolve/ice-inconsistent-resolution-151213.rs

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (7f99507f5 2026-02-19)
binary: rustc
commit-hash: 7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312
commit-date: 2026-02-19
host: x86_64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0

Error output

Command: rustc --edition=2024
(ICEs on edition 2018, 2021, and 2024. Not on 2015)

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
 --> iter7_2f11e5e32bb0210d.rs:2:1
  |
2 | extern crate core as std;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^


thread 'rustc' (15640924) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_resolve/src/imports.rs:1075:21:
assertion failed: import.imported_module.get().is_none()
Backtrace

thread 'rustc' (15640924) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_resolve/src/imports.rs:1075:21:
assertion failed: import.imported_module.get().is_none()
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: <rustc_resolve::Resolver>::finalize_import
   4: <rustc_resolve::Resolver>::resolve_crate::{closure#0}
   5: <rustc_resolve::Resolver>::resolve_crate
   6: rustc_interface::passes::configure_and_expand
   7: rustc_interface::passes::resolver_for_lowering_raw
      [... omitted 1 frame ...]
   8: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
   9: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/Volumes/T7/workspace/out-260219/scratch/rustc-ice-2026-02-20T08_55_51-7183.txt` to your bug report

note: rustc 1.95.0-nightly (7f99507f5 2026-02-19) running on x86_64-apple-darwin

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

Regression

Regression in nightly-2025-09-04
Command: cargo bisect-rustc --start=2025-01-01 --end=2026-02-18 --regress ice --preserve --script rustc -- import.rs --edition=2024

Notes

Metadata

Metadata

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
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions