rust-lang / rust-lang/rust

[ICE]: `assertion failed: !self.tcx.next_trait_solver_globally()`

Open
#152,446 1 comment 0 reactions 1 assignee View on GitHub

@adwinwhite is already working on this.

Since Feb 11, 2026.

C-bug F-type_alias_impl_trait I-ICE T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

original:

//@compile-flags: -Znext-solver=globally
#![feature(type_alias_impl_trait)]
type Tait = impl Iterator<Item = impl Sized>;

#[define_opaque(Tait)]
fn a() {
    let _: Tait = IntoIterator::into_iter([0i32; 0i32]);
}

#[define_opaque(Tait)]
fn b() {
    let _: Tait = IntoIterator::into_iter([0i32; 42 /* <- */]);
}

fn main() {}

Version information

rustc 1.95.0-nightly (d00ba9225 2026-02-10)
binary: rustc
commit-hash: d00ba922591daa3d0a8b0f3cdf54c610097c24ea
commit-date: 2026-02-10
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0

Possibly related line of code:
https://github.com/rust-lang/rust/blob/d00ba922591daa3d0a8b0f3cdf54c610097c24ea/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs#L128-L140

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally

Program output

error: concrete type differs from previous defining opaque type use
  --> a.rs:12:12
   |
12 |     let _: Tait = IntoIterator::into_iter([0i32; 42 /* <- */]);
   |            ^^^^ expected `std::array::IntoIter<i32, 0>`, got `std::array::IntoIter<i32, 42>`
   |
note: previous use here
  --> a.rs:7:12
   |
 7 |     let _: Tait = IntoIterator::into_iter([0i32; 0i32]);
   |            ^^^^


thread 'rustc' (1644810) panicked at /rustc-dev/d00ba922591daa3d0a8b0f3cdf54c610097c24ea/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs:134:9:
assertion failed: !self.tcx.next_trait_solver_globally()
stack backtrace:
   0:     0x7f3f259951db - <<std[9af484578896a6a4]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[802d2132a31a6f72]::fmt::Display>::fmt
   1:     0x7f3f2600ed88 - core[802d2132a31a6f72]::fmt::write
   2:     0x7f3f259ac4c6 - <std[9af484578896a6a4]::sys::stdio::unix::Stderr as std[9af484578896a6a4]::io::Write>::write_fmt
   3:     0x7f3f2596b218 - std[9af484578896a6a4]::panicking::default_hook::{closure#0}
   4:     0x7f3f259885e3 - std[9af484578896a6a4]::panicking::default_hook
   5:     0x7f3f24967acf - std[9af484578896a6a4]::panicking::update_hook::<alloc[d9babc3d00cc4108]::boxed::Box<rustc_driver_impl[8e73ada93af8ee81]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f3f259888c2 - std[9af484578896a6a4]::panicking::panic_with_hook
   7:     0x7f3f2596b30a - std[9af484578896a6a4]::panicking::panic_handler::{closure#0}
   8:     0x7f3f2595f849 - std[9af484578896a6a4]::sys::backtrace::__rust_end_short_backtrace::<std[9af484578896a6a4]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f3f2596cd3d - __rustc[9bfdb1a8a4529abf]::rust_begin_unwind
  10:     0x7f3f229ba88c - core[802d2132a31a6f72]::panicking::panic_fmt
  11:     0x7f3f22015182 - core[802d2132a31a6f72]::panicking::panic
  12:     0x7f3f24aee556 - <rustc_hir_analysis[d8bfd681df41e63a]::collect::type_of::opaque::TaitConstraintLocator>::non_defining_use_in_defining_scope
  13:     0x7f3f24aee8bc - <rustc_hir_analysis[d8bfd681df41e63a]::collect::type_of::opaque::TaitConstraintLocator>::check
  14:     0x7f3f24b2e401 - rustc_hir_analysis[d8bfd681df41e63a]::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
  15:     0x7f3f28013bd9 - rustc_hir_analysis[d8bfd681df41e63a]::collect::type_of::type_of_opaque.cold
  16:     0x7f3f2604d1ab - rustc_query_impl[96f5845f77133f74]::execution::try_execute_query::<rustc_query_system[c2f2fbd096e62cce]::query::caches::DefIdCache<rustc_middle[c89a18844a26074f]::query::erase::ErasedData<[u8; 8usize]>>, {rustc_query_impl[96f5845f77133f74]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  17:     0x7f3f2727245a - rustc_query_impl[96f5845f77133f74]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  18:     0x7f3f2669c788 - rustc_hir_analysis[d8bfd681df41e63a]::collect::type_of::type_of
  19:     0x7f3f26307e26 - rustc_query_impl[96f5845f77133f74]::query_impl::type_of::compute_fn::__rust_begin_short_backtrace
  20:     0x7f3f263c64f4 - rustc_query_impl[96f5845f77133f74]::execution::try_execute_query::<rustc_query_system[c2f2fbd096e62cce]::query::caches::DefIdCache<rustc_middle[c89a18844a26074f]::query::erase::ErasedData<[u8; 8usize]>>, {rustc_query_impl[96f5845f77133f74]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: true }}, false>
  21:     0x7f3f263c609c - rustc_query_impl[96f5845f77133f74]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  22:     0x7f3f2702739c - rustc_hir_analysis[d8bfd681df41e63a]::check::check::check_opaque
  23:     0x7f3f26850205 - rustc_hir_analysis[d8bfd681df41e63a]::check::check::check_item_type
  24:     0x7f3f268488ee - rustc_hir_analysis[d8bfd681df41e63a]::check::wfcheck::check_well_formed
  25:     0x7f3f268488cf - rustc_query_impl[96f5845f77133f74]::query_impl::check_well_formed::compute_fn::__rust_begin_short_backtrace
  26:     0x7f3f268480c6 - rustc_query_impl[96f5845f77133f74]::execution::try_execute_query::<rustc_data_structures[7d5eae3e30998a75]::vec_cache::VecCache<rustc_span[db7d19f050fdd233]::def_id::LocalDefId, rustc_middle[c89a18844a26074f]::query::erase::ErasedData<[u8; 1usize]>, rustc_query_system[c2f2fbd096e62cce]::dep_graph::graph::DepNodeIndex>, {rustc_query_impl[96f5845f77133f74]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  27:     0x7f3f26847e42 - rustc_query_impl[96f5845f77133f74]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f3f2684540a - rustc_hir_analysis[d8bfd681df41e63a]::check::wfcheck::check_type_wf
  29:     0x7f3f268452ab - rustc_query_impl[96f5845f77133f74]::query_impl::check_type_wf::compute_fn::__rust_begin_short_backtrace
  30:     0x7f3f272438eb - rustc_query_impl[96f5845f77133f74]::execution::try_execute_query::<rustc_query_system[c2f2fbd096e62cce]::query::caches::SingleCache<rustc_middle[c89a18844a26074f]::query::erase::ErasedData<[u8; 1usize]>>, {rustc_query_impl[96f5845f77133f74]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  31:     0x7f3f272436c2 - rustc_query_impl[96f5845f77133f74]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f3f26c0c5b3 - rustc_hir_analysis[d8bfd681df41e63a]::check_crate
  33:     0x7f3f26c10a59 - rustc_interface[277f9a2595fb6ae7]::passes::analysis
  34:     0x7f3f2724081a - rustc_query_impl[96f5845f77133f74]::execution::try_execute_query::<rustc_query_system[c2f2fbd096e62cce]::query::caches::SingleCache<rustc_middle[c89a18844a26074f]::query::erase::ErasedData<[u8; 0usize]>>, {rustc_query_impl[96f5845f77133f74]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  35:     0x7f3f272405d0 - rustc_query_impl[96f5845f77133f74]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f3f273eb327 - <rustc_interface[277f9a2595fb6ae7]::passes::create_and_enter_global_ctxt<core[802d2132a31a6f72]::option::Option<rustc_interface[277f9a2595fb6ae7]::queries::Linker>, rustc_driver_impl[8e73ada93af8ee81]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[802d2132a31a6f72]::ops::function::FnOnce<(&rustc_session[4eca5f9ae8c0e42d]::session::Session, rustc_middle[c89a18844a26074f]::ty::context::CurrentGcx, alloc[d9babc3d00cc4108]::sync::Arc<rustc_data_structures[7d5eae3e30998a75]::jobserver::Proxy>, &std[9af484578896a6a4]::sync::once_lock::OnceLock<rustc_middle[c89a18844a26074f]::ty::context::GlobalCtxt>, &rustc_data_structures[7d5eae3e30998a75]::sync::worker_local::WorkerLocal<rustc_middle[c89a18844a26074f]::arena::Arena>, &rustc_data_structures[7d5eae3e30998a75]::sync::worker_local::WorkerLocal<rustc_hir[687ec13789e9964d]::Arena>, rustc_driver_impl[8e73ada93af8ee81]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  37:     0x7f3f27252c39 - rustc_interface[277f9a2595fb6ae7]::interface::run_compiler::<(), rustc_driver_impl[8e73ada93af8ee81]::run_compiler::{closure#0}>::{closure#1}
  38:     0x7f3f27223bfe - std[9af484578896a6a4]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[277f9a2595fb6ae7]::util::run_in_thread_with_globals<rustc_interface[277f9a2595fb6ae7]::util::run_in_thread_pool_with_globals<rustc_interface[277f9a2595fb6ae7]::interface::run_compiler<(), rustc_driver_impl[8e73ada93af8ee81]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  39:     0x7f3f27224120 - <std[9af484578896a6a4]::thread::lifecycle::spawn_unchecked<rustc_interface[277f9a2595fb6ae7]::util::run_in_thread_with_globals<rustc_interface[277f9a2595fb6ae7]::util::run_in_thread_pool_with_globals<rustc_interface[277f9a2595fb6ae7]::interface::run_compiler<(), rustc_driver_impl[8e73ada93af8ee81]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[802d2132a31a6f72]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f3f27224fac - <std[9af484578896a6a4]::sys::thread::unix::Thread>::new::thread_start
  41:     0x7f3f20a9698b - <unknown>
  42:     0x7f3f20b1a9cc - <unknown>
  43:                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/im/rustc-ice-2026-02-10T16_58_17-1644808.txt` to your bug report

note: rustc 1.95.0-nightly (d00ba9225 2026-02-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally

query stack during panic:
#0 [type_of_opaque] computing type of opaque `Tait::{opaque#0}::{opaque#0}`
#1 [type_of] computing type of `Tait::{opaque#0}::{opaque#0}`
#2 [check_well_formed] checking that `Tait::{opaque#0}::{opaque#0}` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `a`
end of query stack
error: aborting due to 1 previous error

@rustbot label +F-type_alias_impl_trait +WG-trait-system-refactor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.