Skip to content

ICE: None != Some(DeclData .. #150929

@matthiaskrgr

Description

@matthiaskrgr

Code

// --edition=2024
mod a {
  mod b {
    mod c { pub struct E; }
    mod d {
      mod c { pub struct E; }
      mod d {#[derive(Debug)] pub struct E;
      }
      use d::*;
      pub use c::*;
    }
    use d::*;
    use c::*;
  }
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (1b9ae9edd 2026-01-10)
binary: rustc
commit-hash: 1b9ae9eddcbd3b0105a0828e323c6db5f1e6ad0c
commit-date: 2026-01-10
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

Error output

rustc --edition=2024 a.rs

thread 'rustc' (814224) panicked at /rustc-dev/1b9ae9eddcbd3b0105a0828e323c6db5f1e6ad0c/compiler/rustc_resolve/src/imports.rs:305:9:
assertion `left == right` failed
  left: None
 right: Some(DeclData { kind: Import { source_decl: DeclData { kind: Def(Def(Struct, DefId(0:6 ~ a[83dd]::a::b::c::E))), ambiguity: CmCell(None), warn_ambiguity: CmCell(false), expansion: expn0, span: a.rs:4:13: 4:26 (#0), vis: CmCell(Public) }, import: ImportData { kind: Glob { max_vis: CmCell(Some(Restricted(DefId(0:4 ~ a[83dd]::a::b)))), id: NodeId(24) }, root_id: NodeId(24), use_span: a.rs:13:5: 13:14 (#0), use_span_with_attributes: a.rs:13:5: 13:14 (#0), has_attributes: false, span: a.rs:13:9: 13:13 (#0), root_span: a.rs:13:9: 13:13 (#0), parent_scope: ParentScope { module: Some(Def(Mod, DefId(0:4 ~ a[83dd]::a::b))), expansion: expn0, macro_rules: Cell { value: Empty }, derives: [] }, module_path: [Segment { ident: c#0, id: Some(NodeId(25)), has_generic_args: false, has_lifetime_args: false, args_span: no-location (#0) }], imported_module: CmCell(Some(Module(Some(Def(Mod, DefId(0:5 ~ a[83dd]::a::b::c)))))), vis: Restricted(DefId(0:4 ~ a[83dd]::a::b)), vis_span: a.rs:13:5: 13:5 (#0) } }, ambiguity: CmCell(None), warn_ambiguity: CmCell(false), expansion: expn0, span: a.rs:13:9: 13:13 (#0), vis: CmCell(Restricted(DefId(0:4 ~ a[83dd]::a::b))) })
stack backtrace:
   0:     0x7fdc2523a273 - <<std[6938aa076b36c5ac]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[bccd4b2d6cdb7e20]::fmt::Display>::fmt
   1:     0x7fdc2580fa08 - core[bccd4b2d6cdb7e20]::fmt::write
   2:     0x7fdc252504f6 - <std[6938aa076b36c5ac]::sys::stdio::unix::Stderr as std[6938aa076b36c5ac]::io::Write>::write_fmt
   3:     0x7fdc2520fe68 - std[6938aa076b36c5ac]::panicking::default_hook::{closure#0}
   4:     0x7fdc2522db03 - std[6938aa076b36c5ac]::panicking::default_hook
   5:     0x7fdc2421089a - std[6938aa076b36c5ac]::panicking::update_hook::<alloc[86015bdb52244da1]::boxed::Box<rustc_driver_impl[350e86f741145418]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fdc2522dde2 - std[6938aa076b36c5ac]::panicking::panic_with_hook
   7:     0x7fdc2520ff28 - std[6938aa076b36c5ac]::panicking::panic_handler::{closure#0}
   8:     0x7fdc25206be9 - std[6938aa076b36c5ac]::sys::backtrace::__rust_end_short_backtrace::<std[6938aa076b36c5ac]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fdc252119fd - __rustc[3c543be16ed5e038]::rust_begin_unwind
  10:     0x7fdc22627eec - core[bccd4b2d6cdb7e20]::panicking::panic_fmt
  11:     0x7fdc23b9b2e3 - core[bccd4b2d6cdb7e20]::panicking::assert_failed_inner
  12:     0x7fdc24d6b2c3 - core[bccd4b2d6cdb7e20]::panicking::assert_failed::<core[bccd4b2d6cdb7e20]::option::Option<rustc_data_structures[4857a5955d067035]::intern::Interned<rustc_resolve[51f9131d78059eb1]::DeclData>>, core[bccd4b2d6cdb7e20]::option::Option<rustc_data_structures[4857a5955d067035]::intern::Interned<rustc_resolve[51f9131d78059eb1]::DeclData>>>
  13:     0x7fdc2583a895 - <rustc_resolve[51f9131d78059eb1]::Resolver>::try_plant_decl_into_local_module
  14:     0x7fdc258398cc - <rustc_resolve[51f9131d78059eb1]::Resolver>::try_plant_decl_into_local_module
  15:     0x7fdc258398cc - <rustc_resolve[51f9131d78059eb1]::Resolver>::try_plant_decl_into_local_module
  16:     0x7fdc25f045fa - <rustc_resolve[51f9131d78059eb1]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[85e5d7c876d0cc7f]::visit::Visitor>::visit_item
  17:     0x7fdc25f105b5 - <rustc_resolve[51f9131d78059eb1]::Resolver as rustc_expand[c61a0465d3b74d74]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  18:     0x7fdc26e30e0e - <rustc_expand[c61a0465d3b74d74]::expand::MacroExpander>::fully_expand_fragment
  19:     0x7fdc26e1c052 - <rustc_expand[c61a0465d3b74d74]::expand::MacroExpander>::expand_crate
  20:     0x7fdc25e78474 - rustc_interface[9706804fe87156b4]::passes::configure_and_expand
  21:     0x7fdc269f2718 - rustc_interface[9706804fe87156b4]::passes::resolver_for_lowering_raw
  22:     0x7fdc269f248d - rustc_query_impl[283934abf3e4e915]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[283934abf3e4e915]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[11388d43b036737e]::query::erase::Erased<[u8; 16usize]>>
  23:     0x7fdc269f246b - <rustc_query_impl[283934abf3e4e915]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[bccd4b2d6cdb7e20]::ops::function::FnOnce<(rustc_middle[11388d43b036737e]::ty::context::TyCtxt, ())>>::call_once
  24:     0x7fdc269ca81f - rustc_query_system[38817e29eb7d5b8b]::query::plumbing::try_execute_query::<rustc_query_impl[283934abf3e4e915]::DynamicConfig<rustc_query_system[38817e29eb7d5b8b]::query::caches::SingleCache<rustc_middle[11388d43b036737e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[283934abf3e4e915]::plumbing::QueryCtxt, false>
  25:     0x7fdc269ca37c - rustc_query_impl[283934abf3e4e915]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7fdc26b8917b - <rustc_interface[9706804fe87156b4]::passes::create_and_enter_global_ctxt<core[bccd4b2d6cdb7e20]::option::Option<rustc_interface[9706804fe87156b4]::queries::Linker>, rustc_driver_impl[350e86f741145418]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[bccd4b2d6cdb7e20]::ops::function::FnOnce<(&rustc_session[f9d61e7a9f67467e]::session::Session, rustc_middle[11388d43b036737e]::ty::context::CurrentGcx, alloc[86015bdb52244da1]::sync::Arc<rustc_data_structures[4857a5955d067035]::jobserver::Proxy>, &std[6938aa076b36c5ac]::sync::once_lock::OnceLock<rustc_middle[11388d43b036737e]::ty::context::GlobalCtxt>, &rustc_data_structures[4857a5955d067035]::sync::worker_local::WorkerLocal<rustc_middle[11388d43b036737e]::arena::Arena>, &rustc_data_structures[4857a5955d067035]::sync::worker_local::WorkerLocal<rustc_hir[bde87669acea4e53]::Arena>, rustc_driver_impl[350e86f741145418]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  27:     0x7fdc26a7f698 - rustc_interface[9706804fe87156b4]::interface::run_compiler::<(), rustc_driver_impl[350e86f741145418]::run_compiler::{closure#0}>::{closure#1}
  28:     0x7fdc269966fa - std[6938aa076b36c5ac]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[9706804fe87156b4]::util::run_in_thread_with_globals<rustc_interface[9706804fe87156b4]::util::run_in_thread_pool_with_globals<rustc_interface[9706804fe87156b4]::interface::run_compiler<(), rustc_driver_impl[350e86f741145418]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x7fdc269964be - <std[6938aa076b36c5ac]::thread::lifecycle::spawn_unchecked<rustc_interface[9706804fe87156b4]::util::run_in_thread_with_globals<rustc_interface[9706804fe87156b4]::util::run_in_thread_pool_with_globals<rustc_interface[9706804fe87156b4]::interface::run_compiler<(), rustc_driver_impl[350e86f741145418]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bccd4b2d6cdb7e20]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7fdc26998282 - <std[6938aa076b36c5ac]::sys::thread::unix::Thread>::new::thread_start
  31:     0x7fdc2029698b - <unknown>
  32:     0x7fdc2031a9cc - <unknown>
  33:                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/im2/rustc-ice-2026-01-10T12_56_28-814222.txt` to your bug report

note: rustc 1.94.0-nightly (1b9ae9edd 2026-01-10) 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
Backtrace

<backtrace>

Metadata

Metadata

Assignees

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) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions