Skip to content

[ICE]: assertion failed: !deep_decl.is_glob_import() #152606

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

mod foo {

    pub use crate::f;
}

use foo::*;
pub use foo::*;
mod baz {
    pub use super::*;
}

original:

//@ check-pass

mod foo {
    pub use crate::bar::*;
    pub use crate::f as f;
}

mod bar {
    pub use cratebazfoo::*;
}

 use foo::*;
pub use foo::*;
mod baz {
    pub use super::*;
}

pub fn main() {}

Version information

rustc 1.95.0-nightly (29fa07e3d 2026-02-14)
binary: rustc
commit-hash: 29fa07e3dbca35d58c0770042f04ba464eb3db4c
commit-date: 2026-02-14
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

if deep_decl != glob_decl {
// Some import layers have been removed, need to overwrite.
assert_ne!(old_deep_decl, old_glob_decl);
// FIXME: reenable the asserts when `warn_ambiguity` is removed (#149195).
// assert_ne!(old_deep_decl, deep_decl);
// assert!(old_deep_decl.is_glob_import());
assert!(!deep_decl.is_glob_import());
if old_glob_decl.ambiguity.get().is_some() && glob_decl.ambiguity.get().is_none() {
// Do not lose glob ambiguities when re-fetching the glob.
glob_decl.ambiguity.set_unchecked(old_glob_decl.ambiguity.get());
}
if glob_decl.is_ambiguity_recursive() {
glob_decl.warn_ambiguity.set_unchecked(true);

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

Program output


thread 'rustc' (3858848) panicked at /rustc-dev/29fa07e3dbca35d58c0770042f04ba464eb3db4c/compiler/rustc_resolve/src/imports.rs:387:13:
assertion failed: !deep_decl.is_glob_import()
stack backtrace:
   0:     0x7fd8651c186b - <<std[c662f761b3162217]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[bca9fa23106855ea]::fmt::Display>::fmt
   1:     0x7fd865811008 - core[bca9fa23106855ea]::fmt::write
   2:     0x7fd8651d8ae6 - <std[c662f761b3162217]::sys::stdio::unix::Stderr as std[c662f761b3162217]::io::Write>::write_fmt
   3:     0x7fd865197918 - std[c662f761b3162217]::panicking::default_hook::{closure#0}
   4:     0x7fd8651b4cd3 - std[c662f761b3162217]::panicking::default_hook
   5:     0x7fd86418c24f - std[c662f761b3162217]::panicking::update_hook::<alloc[46a303b34e50f2de]::boxed::Box<rustc_driver_impl[200a981e5d0727dc]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fd8651b4fb2 - std[c662f761b3162217]::panicking::panic_with_hook
   7:     0x7fd865197a0a - std[c662f761b3162217]::panicking::panic_handler::{closure#0}
   8:     0x7fd86518bf49 - std[c662f761b3162217]::sys::backtrace::__rust_end_short_backtrace::<std[c662f761b3162217]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fd86519943d - __rustc[aa26d802e41153f]::rust_begin_unwind
  10:     0x7fd8623a2f7c - core[bca9fa23106855ea]::panicking::panic_fmt
  11:     0x7fd8618324d2 - core[bca9fa23106855ea]::panicking::panic
  12:     0x7fd865820b89 - <rustc_resolve[d63c27fa0666900]::Resolver>::try_plant_decl_into_local_module
  13:     0x7fd86582018b - <rustc_resolve[d63c27fa0666900]::Resolver>::try_plant_decl_into_local_module
  14:     0x7fd86582018b - <rustc_resolve[d63c27fa0666900]::Resolver>::try_plant_decl_into_local_module
  15:     0x7fd861c0f584 - <rustc_resolve[d63c27fa0666900]::Resolver>::import_dummy_binding::{closure#1}
  16:     0x7fd865efd09c - <rustc_resolve[d63c27fa0666900]::Resolver>::resolve_crate::{closure#0}
  17:     0x7fd865ef718d - <rustc_resolve[d63c27fa0666900]::Resolver>::resolve_crate
  18:     0x7fd86618066f - rustc_interface[43e32e48468328a3]::passes::resolver_for_lowering_raw
  19:     0x7fd86617f66b - rustc_query_impl[a646e849d64661b4]::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
  20:     0x7fd866a5d16c - rustc_query_impl[a646e849d64661b4]::execution::try_execute_query::<rustc_query_system[4f0e9885d2fdb68f]::query::caches::SingleCache<rustc_middle[429f93a97423b435]::query::erase::ErasedData<[u8; 16usize]>>, {rustc_query_impl[a646e849d64661b4]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  21:     0x7fd866a5ccc2 - rustc_query_impl[a646e849d64661b4]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  22:     0x7fd866c3b74f - <rustc_interface[43e32e48468328a3]::passes::create_and_enter_global_ctxt<core[bca9fa23106855ea]::option::Option<rustc_interface[43e32e48468328a3]::queries::Linker>, rustc_driver_impl[200a981e5d0727dc]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[bca9fa23106855ea]::ops::function::FnOnce<(&rustc_session[a2f6e801d61d6ba1]::session::Session, rustc_middle[429f93a97423b435]::ty::context::CurrentGcx, alloc[46a303b34e50f2de]::sync::Arc<rustc_data_structures[19ea501b696d1d55]::jobserver::Proxy>, &std[c662f761b3162217]::sync::once_lock::OnceLock<rustc_middle[429f93a97423b435]::ty::context::GlobalCtxt>, &rustc_data_structures[19ea501b696d1d55]::sync::worker_local::WorkerLocal<rustc_middle[429f93a97423b435]::arena::Arena>, &rustc_data_structures[19ea501b696d1d55]::sync::worker_local::WorkerLocal<rustc_hir[4e52745c19aa4c0a]::Arena>, rustc_driver_impl[200a981e5d0727dc]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  23:     0x7fd866a3dd37 - rustc_interface[43e32e48468328a3]::interface::run_compiler::<(), rustc_driver_impl[200a981e5d0727dc]::run_compiler::{closure#0}>::{closure#1}
  24:     0x7fd866a244fe - std[c662f761b3162217]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[43e32e48468328a3]::util::run_in_thread_with_globals<rustc_interface[43e32e48468328a3]::util::run_in_thread_pool_with_globals<rustc_interface[43e32e48468328a3]::interface::run_compiler<(), rustc_driver_impl[200a981e5d0727dc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  25:     0x7fd866a24be0 - <std[c662f761b3162217]::thread::lifecycle::spawn_unchecked<rustc_interface[43e32e48468328a3]::util::run_in_thread_with_globals<rustc_interface[43e32e48468328a3]::util::run_in_thread_pool_with_globals<rustc_interface[43e32e48468328a3]::interface::run_compiler<(), rustc_driver_impl[200a981e5d0727dc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bca9fa23106855ea]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7fd866a25a6c - <std[c662f761b3162217]::sys::thread::unix::Thread>::new::thread_start
  27:     0x7fd86029698b - <unknown>
  28:     0x7fd86031a9cc - <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.95.0-nightly (29fa07e3d 2026-02-14) 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

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 priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions