Skip to content

[ICE]: argument DefId is not a module #153848

@sososopy

Description

@sososopy

Code

pub(in a) mod aa {
}
mod test {
    #[cfg(test)]
    use super::a;
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (1d8897a4e 2026-03-13)
binary: rustc
commit-hash: 1d8897a4e88051480b36c501e66809425c6e08ad
commit-date: 2026-03-13
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Error output

None
Backtrace

thread 'rustc' (2906866) panicked at /rustc-dev/1d8897a4e88051480b36c501e66809425c6e08ad/compiler/rustc_resolve/src/build_reduced_graph.rs:145:33:
argument `DefId` is not a module
stack backtrace:
   0:     0x7a002bf3371b - <<std[1c12824126ab204a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[86029f731b087684]::fmt::Display>::fmt
   1:     0x7a002c61ccc8 - core[86029f731b087684]::fmt::write
   2:     0x7a002bf4a726 - <std[1c12824126ab204a]::sys::stdio::unix::Stderr as std[1c12824126ab204a]::io::Write>::write_fmt
   3:     0x7a002bf09808 - std[1c12824126ab204a]::panicking::default_hook::{closure#0}
   4:     0x7a002bf26b93 - std[1c12824126ab204a]::panicking::default_hook
   5:     0x7a002af22d0c - std[1c12824126ab204a]::panicking::update_hook::<alloc[4f8a3791c62ca0ca]::boxed::Box<rustc_driver_impl[51f7c9edb5d05cb7]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7a002bf26e72 - std[1c12824126ab204a]::panicking::panic_with_hook
   7:     0x7a002bf098c8 - std[1c12824126ab204a]::panicking::panic_handler::{closure#0}
   8:     0x7a002befde19 - std[1c12824126ab204a]::sys::backtrace::__rust_end_short_backtrace::<std[1c12824126ab204a]::panicking::panic_handler::{closure#0}, !>
   9:     0x7a002bf0b32d - __rustc[617f3f0615c04812]::rust_begin_unwind
  10:     0x7a0028aec95c - core[86029f731b087684]::panicking::panic_fmt
  11:     0x7a0029ae0324 - core[86029f731b087684]::option::expect_failed
  12:     0x7a002bacc436 - <rustc_resolve[efb54a1b1381a4ff]::Resolver>::find_cfg_stripped::comes_from_same_module_for_glob
  13:     0x7a002bab51d0 - <rustc_resolve[efb54a1b1381a4ff]::Resolver>::find_cfg_stripped
  14:     0x7a002a6e894e - <rustc_resolve[efb54a1b1381a4ff]::Resolver>::into_struct_error
  15:     0x7a002cd2024f - <rustc_resolve[efb54a1b1381a4ff]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[670a67dc5d9bdd75]::visit::Visitor>::visit_item
  16:     0x7a002cd25439 - <rustc_resolve[efb54a1b1381a4ff]::Resolver as rustc_expand[ac389242bd5f5e95]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  17:     0x7a002cbad4d6 - <rustc_expand[ac389242bd5f5e95]::expand::MacroExpander>::collect_invocations
  18:     0x7a002dc05266 - <rustc_expand[ac389242bd5f5e95]::expand::MacroExpander>::fully_expand_fragment
  19:     0x7a002dc04cdb - <rustc_expand[ac389242bd5f5e95]::expand::MacroExpander>::expand_crate
  20:     0x7a002cba67a3 - rustc_interface[a1db20cb550d7706]::passes::configure_and_expand
  21:     0x7a002d8ca578 - rustc_interface[a1db20cb550d7706]::passes::resolver_for_lowering_raw
  22:     0x7a002d8ca2e3 - rustc_query_impl[59fb8fd7261b243f]::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
  23:     0x7a002d8715e9 - rustc_query_impl[59fb8fd7261b243f]::execution::try_execute_query::<rustc_middle[bfabc05c2f0f5726]::query::caches::SingleCache<rustc_middle[bfabc05c2f0f5726]::query::erase::ErasedData<[u8; 16usize]>>, false>
  24:     0x7a002d87114e - rustc_query_impl[59fb8fd7261b243f]::query_impl::resolver_for_lowering_raw::execute_query_non_incr::__rust_end_short_backtrace
  25:     0x7a002d841732 - rustc_interface[a1db20cb550d7706]::interface::run_compiler::<(), rustc_driver_impl[51f7c9edb5d05cb7]::run_compiler::{closure#0}>::{closure#1}
  26:     0x7a002d826a7e - std[1c12824126ab204a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a1db20cb550d7706]::util::run_in_thread_with_globals<rustc_interface[a1db20cb550d7706]::util::run_in_thread_pool_with_globals<rustc_interface[a1db20cb550d7706]::interface::run_compiler<(), rustc_driver_impl[51f7c9edb5d05cb7]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  27:     0x7a002d827320 - <std[1c12824126ab204a]::thread::lifecycle::spawn_unchecked<rustc_interface[a1db20cb550d7706]::util::run_in_thread_with_globals<rustc_interface[a1db20cb550d7706]::util::run_in_thread_pool_with_globals<rustc_interface[a1db20cb550d7706]::interface::run_compiler<(), rustc_driver_impl[51f7c9edb5d05cb7]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[86029f731b087684]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7a002d8281ac - <std[1c12824126ab204a]::sys::thread::unix::Thread>::new::thread_start
  29:     0x7a0027094ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  30:     0x7a00271268d0 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
  31:                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 `/data2/wangpengyang/bug/src/rustc-ice-2026-03-14T07_13_53-2906856.txt` to your bug report

note: rustc 1.96.0-nightly (1d8897a4e 2026-03-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

Metadata

Metadata

Assignees

Labels

C-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