Skip to content

[ICE]: !self.tcx.next_trait_solver_globally() #151322

@matthiaskrgr

Description

@matthiaskrgr

Code

rustc code.rs --edition=2021 -Znext-solver=globally

#![feature(type_alias_impl_trait)]
fn main() {
    type T = impl Copy;
    let foo: T = async {};
}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (fe98ddcfc 2026-01-17)
binary: rustc
commit-hash: fe98ddcfcfb6f185dbf4adeaf439d8a756da0273
commit-date: 2026-01-17
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

Error output

<output>
Backtrace


thread 'rustc' (1731107) panicked at /rustc-dev/fe98ddcfcfb6f185dbf4adeaf439d8a756da0273/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs:134:9:
assertion failed: !self.tcx.next_trait_solver_globally()
stack backtrace:
   0:     0x7f6f52042f93 - <<std[7637d35b2e73f491]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e59341b65d367131]::fmt::Display>::fmt
   1:     0x7f6f5260e2c8 - core[e59341b65d367131]::fmt::write
   2:     0x7f6f52059986 - <std[7637d35b2e73f491]::sys::stdio::unix::Stderr as std[7637d35b2e73f491]::io::Write>::write_fmt
   3:     0x7f6f52019008 - std[7637d35b2e73f491]::panicking::default_hook::{closure#0}
   4:     0x7f6f520366c3 - std[7637d35b2e73f491]::panicking::default_hook
   5:     0x7f6f5100b7fa - std[7637d35b2e73f491]::panicking::update_hook::<alloc[e4cd1c42012959c4]::boxed::Box<rustc_driver_impl[1a3eae45778b1a3a]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f6f520369a2 - std[7637d35b2e73f491]::panicking::panic_with_hook
   7:     0x7f6f520190fa - std[7637d35b2e73f491]::panicking::panic_handler::{closure#0}
   8:     0x7f6f5200d579 - std[7637d35b2e73f491]::sys::backtrace::__rust_end_short_backtrace::<std[7637d35b2e73f491]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f6f5201ab9d - __rustc[f6c708c0d8e4bdd6]::rust_begin_unwind
  10:     0x7f6f4f2e91fc - core[e59341b65d367131]::panicking::panic_fmt
  11:     0x7f6f4e7d3892 - core[e59341b65d367131]::panicking::panic
  12:     0x7f6f511b1306 - <rustc_hir_analysis[5017dacce67ac1a4]::collect::type_of::opaque::TaitConstraintLocator>::non_defining_use_in_defining_scope
  13:     0x7f6f511b1762 - <rustc_hir_analysis[5017dacce67ac1a4]::collect::type_of::opaque::TaitConstraintLocator>::check
  14:     0x7f6f511f1f90 - rustc_hir_analysis[5017dacce67ac1a4]::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
  15:     0x7f6f545443f4 - rustc_hir_analysis[5017dacce67ac1a4]::collect::type_of::type_of_opaque.cold
  16:     0x7f6f535fcba3 - rustc_query_impl[f993d76296ac3ede]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f993d76296ac3ede]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 8usize]>>
  17:     0x7f6f52617c45 - rustc_query_system[11b36a7129bd2e9f]::query::plumbing::try_execute_query::<rustc_query_impl[f993d76296ac3ede]::DynamicConfig<rustc_query_system[11b36a7129bd2e9f]::query::caches::DefIdCache<rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f993d76296ac3ede]::plumbing::QueryCtxt, false>
  18:     0x7f6f5383841b - rustc_query_impl[f993d76296ac3ede]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  19:     0x7f6f52dbb7b6 - rustc_hir_analysis[5017dacce67ac1a4]::collect::type_of::type_of
  20:     0x7f6f5278f866 - rustc_query_impl[f993d76296ac3ede]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f993d76296ac3ede]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 8usize]>>
  21:     0x7f6f52617c45 - rustc_query_system[11b36a7129bd2e9f]::query::plumbing::try_execute_query::<rustc_query_impl[f993d76296ac3ede]::DynamicConfig<rustc_query_system[11b36a7129bd2e9f]::query::caches::DefIdCache<rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f993d76296ac3ede]::plumbing::QueryCtxt, false>
  22:     0x7f6f526177ef - rustc_query_impl[f993d76296ac3ede]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f6f535fd73b - rustc_hir_analysis[5017dacce67ac1a4]::check::check::check_opaque
  24:     0x7f6f52d83e78 - rustc_hir_analysis[5017dacce67ac1a4]::check::check::check_item_type
  25:     0x7f6f52d7bd1c - rustc_hir_analysis[5017dacce67ac1a4]::check::wfcheck::check_well_formed
  26:     0x7f6f52d7bceb - rustc_query_impl[f993d76296ac3ede]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f993d76296ac3ede]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 1usize]>>
  27:     0x7f6f52d7b763 - rustc_query_system[11b36a7129bd2e9f]::query::plumbing::try_execute_query::<rustc_query_impl[f993d76296ac3ede]::DynamicConfig<rustc_data_structures[ab77da159d78a1fb]::vec_cache::VecCache<rustc_span[d2f47af3535269a]::def_id::LocalDefId, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[11b36a7129bd2e9f]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f993d76296ac3ede]::plumbing::QueryCtxt, false>
  28:     0x7f6f52d7b256 - rustc_query_impl[f993d76296ac3ede]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7f6f52d78a51 - rustc_hir_analysis[5017dacce67ac1a4]::check::wfcheck::check_type_wf
  30:     0x7f6f52d788dd - rustc_query_impl[f993d76296ac3ede]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f993d76296ac3ede]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7f6f537f90d1 - rustc_query_system[11b36a7129bd2e9f]::query::plumbing::try_execute_query::<rustc_query_impl[f993d76296ac3ede]::DynamicConfig<rustc_query_system[11b36a7129bd2e9f]::query::caches::SingleCache<rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f993d76296ac3ede]::plumbing::QueryCtxt, false>
  32:     0x7f6f537f8d82 - rustc_query_impl[f993d76296ac3ede]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f6f52e14296 - rustc_hir_analysis[5017dacce67ac1a4]::check_crate
  34:     0x7f6f52762e5b - rustc_interface[70956b6af7f02b7a]::passes::analysis
  35:     0x7f6f52762ab5 - rustc_query_impl[f993d76296ac3ede]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f993d76296ac3ede]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7f6f537f9e23 - rustc_query_system[11b36a7129bd2e9f]::query::plumbing::try_execute_query::<rustc_query_impl[f993d76296ac3ede]::DynamicConfig<rustc_query_system[11b36a7129bd2e9f]::query::caches::SingleCache<rustc_middle[f49c2f37af7e8c7e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f993d76296ac3ede]::plumbing::QueryCtxt, false>
  37:     0x7f6f537f9c0e - rustc_query_impl[f993d76296ac3ede]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f6f53817dd1 - <rustc_interface[70956b6af7f02b7a]::passes::create_and_enter_global_ctxt<core[e59341b65d367131]::option::Option<rustc_interface[70956b6af7f02b7a]::queries::Linker>, rustc_driver_impl[1a3eae45778b1a3a]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[e59341b65d367131]::ops::function::FnOnce<(&rustc_session[ef90395b1d579b60]::session::Session, rustc_middle[f49c2f37af7e8c7e]::ty::context::CurrentGcx, alloc[e4cd1c42012959c4]::sync::Arc<rustc_data_structures[ab77da159d78a1fb]::jobserver::Proxy>, &std[7637d35b2e73f491]::sync::once_lock::OnceLock<rustc_middle[f49c2f37af7e8c7e]::ty::context::GlobalCtxt>, &rustc_data_structures[ab77da159d78a1fb]::sync::worker_local::WorkerLocal<rustc_middle[f49c2f37af7e8c7e]::arena::Arena>, &rustc_data_structures[ab77da159d78a1fb]::sync::worker_local::WorkerLocal<rustc_hir[78cba43770fa9cc1]::Arena>, rustc_driver_impl[1a3eae45778b1a3a]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  39:     0x7f6f53798cf4 - rustc_interface[70956b6af7f02b7a]::interface::run_compiler::<(), rustc_driver_impl[1a3eae45778b1a3a]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f6f53735dba - std[7637d35b2e73f491]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[70956b6af7f02b7a]::util::run_in_thread_with_globals<rustc_interface[70956b6af7f02b7a]::util::run_in_thread_pool_with_globals<rustc_interface[70956b6af7f02b7a]::interface::run_compiler<(), rustc_driver_impl[1a3eae45778b1a3a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f6f53735b7e - <std[7637d35b2e73f491]::thread::lifecycle::spawn_unchecked<rustc_interface[70956b6af7f02b7a]::util::run_in_thread_with_globals<rustc_interface[70956b6af7f02b7a]::util::run_in_thread_pool_with_globals<rustc_interface[70956b6af7f02b7a]::interface::run_compiler<(), rustc_driver_impl[1a3eae45778b1a3a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e59341b65d367131]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f6f53737944 - <std[7637d35b2e73f491]::sys::thread::unix::Thread>::new::thread_start
  43:     0x7f6f4d09698b - <unknown>
  44:     0x7f6f4d11a9cc - <unknown>
  45:                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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-01-18T16_59_27-1731089.txt` to your bug report

note: rustc 1.94.0-nightly (fe98ddcfc 2026-01-17) 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 `main::T::{opaque#0}`
#1 [type_of] computing type of `main::T::{opaque#0}`
#2 [check_well_formed] checking that `main::T::{opaque#0}` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `code`
end of query stack
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: errors selecting obligation during MIR typeck: query type op DefId(0:3 ~ code[8cd8]::main) [TrueError]
  |
  = note: delayed at /rustc-dev/fe98ddcfcfb6f185dbf4adeaf439d8a756da0273/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:103:29
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<alloc::string::String>
             4: <rustc_borrowck::type_check::TypeChecker>::ascribe_user_type
             5: rustc_borrowck::type_check::type_check
             6: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
             7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
             8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
             9: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
            10: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
            11: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
            12: rustc_hir_analysis::collect::type_of::type_of_opaque.cold
            13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            15: rustc_query_impl::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
            16: rustc_hir_analysis::collect::type_of::type_of
            17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            19: rustc_query_impl::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
            20: rustc_hir_analysis::check::check::check_opaque
            21: rustc_hir_analysis::check::check::check_item_type
            22: rustc_hir_analysis::check::wfcheck::check_well_formed
            23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            25: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
            26: rustc_hir_analysis::check::wfcheck::check_type_wf
            27: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            28: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            29: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
            30: rustc_hir_analysis::check_crate
            31: rustc_interface::passes::analysis
            32: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
            33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            34: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            35: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
            36: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            37: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            38: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            39: <std::sys::thread::unix::Thread>::new::thread_start
            40: <unknown>
            41: <unknown>


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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-01-18T16_59_27-1731089.txt` to your bug report

note: rustc 1.94.0-nightly (fe98ddcfc 2026-01-17) running on x86_64-unknown-linux-gnu

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

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions