Skip to content

ICE: normalization_nested_goals.is_empty() #140571

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

pub trait IsVoid {
    const IS_VOID: bool;
}
impl<T> IsVoid for T {
    default const IS_VOID: bool = false;
}
impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}

pub trait NotVoid {}
impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {}

pub trait Maybe<T> {}
impl<T> Maybe<T> for T {}

original:

#![feature(associated_const_equality)]

pub trait IsVoid
{
    const IS_VOID: bool;
}
impl<T> IsVoid for T
where
    T: ?Sized
{
    default const IS_VOID: bool = false;
}
impl<T> Maybe<T> for ()
where
    T: NotVoid + ?Sized
{

}

pub trait NotVoid: IsVoid<IS_VOID = false>
{

}
impl<T> NotVoid for T
where
    T: IsVoid<IS_VOID = false> + ?Sized
{

}

pub trait Maybe<T>
where
    T: ?Sized
{

}
impl<T> Maybe<T> for T
where
    T: ?Sized
{

}
impl<T> Maybe<T> for ()
where
    T: NotVoid + ?IS_VOID
{

}

Version information

rustc 1.88.0-nightly (3350c1eb3 2025-05-01)
binary: rustc
commit-hash: 3350c1eb3fd8fe1bee1ed4c76944d707bd256876
commit-date: 2025-05-01
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

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

Program output

error[E0658]: associated const equality is incomplete
  --> /tmp/icemaker_global_tempdir.MMq3pVFxDMRt/rustc_testrunner_tmpdir_reporting.r7Xb3xN2awRv/mvce.rs:10:39
   |
10 | impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {}
   |                                       ^^^^^^^^^^^^^^^
   |
   = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
   = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
   = note: this compiler was built on 2025-05-01; consider upgrading it if it is out of date

error[E0658]: specialization is unstable
 --> /tmp/icemaker_global_tempdir.MMq3pVFxDMRt/rustc_testrunner_tmpdir_reporting.r7Xb3xN2awRv/mvce.rs:5:5
  |
5 |     default const IS_VOID: bool = false;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
  = help: add `#![feature(specialization)]` to the crate attributes to enable
  = note: this compiler was built on 2025-05-01; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.MMq3pVFxDMRt/rustc_testrunner_tmpdir_reporting.r7Xb3xN2awRv/mvce.rs:13:26
   |
13 | impl<T> Maybe<T> for T {}
   |                          ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.MMq3pVFxDMRt/rustc_testrunner_tmpdir_reporting.r7Xb3xN2awRv/mvce.rs`


thread 'rustc' panicked at /rustc/3350c1eb3fd8fe1bee1ed4c76944d707bd256876/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:445:9:
assertion failed: normalization_nested_goals.is_empty()
stack backtrace:
   0:     0x7fb51052fec3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h542d155fb00771a6
   1:     0x7fb510c059c7 - core::fmt::write::h5c20ef0aafe2b529
   2:     0x7fb511c85751 - std::io::Write::write_fmt::hac11ffd732faa171
   3:     0x7fb51052fd22 - std::sys::backtrace::BacktraceLock::print::h47f90f237b73cbf4
   4:     0x7fb510533b6a - std::panicking::default_hook::{{closure}}::h6282c72a1387d25f
   5:     0x7fb5105336ef - std::panicking::default_hook::he6b494ff3c83ead4
   6:     0x7fb50f57c3c3 - std[fa717b9852406dd]::panicking::update_hook::<alloc[a770b99575d6623a]::boxed::Box<rustc_driver_impl[24e7910ed411b030]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fb5105343e3 - std::panicking::rust_panic_with_hook::h149b08272aeb16bc
   8:     0x7fb5105340a6 - std::panicking::begin_panic_handler::{{closure}}::hcdbe86989a0ba44a
   9:     0x7fb510530399 - std::sys::backtrace::__rust_end_short_backtrace::hf8d59804c2387dc6
  10:     0x7fb510533d9d - __rustc[2d4870ff425ddf61]::rust_begin_unwind
  11:     0x7fb50ce7b7a0 - core::panicking::panic_fmt::he8c25f98fc794a04
  12:     0x7fb50ce7fabc - core::panicking::panic::h241b8ebf40fea67e
  13:     0x7fb5118c38e6 - <rustc_next_trait_solver[8c99bf01a920f0da]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[719b9ee30517a3be]::solve::delegate::SolverDelegate, rustc_middle[2743830fcd413abb]::ty::context::TyCtxt>>::enter_root::<core[2e44cabe4492cfed]::result::Result<(rustc_next_trait_solver[8c99bf01a920f0da]::solve::HasChanged, rustc_type_ir[fe71196d49a53c54]::solve::Certainty), rustc_type_ir[fe71196d49a53c54]::solve::NoSolution>, <rustc_trait_selection[719b9ee30517a3be]::solve::delegate::SolverDelegate as rustc_next_trait_solver[8c99bf01a920f0da]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal::{closure#0}>
  14:     0x7fb511cca88d - <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError>>::select_where_possible
  15:     0x7fb511cca51f - <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError>>::select_all_or_error
  16:     0x7fb5110d5e53 - <rustc_infer[93fa11d9f5df17b1]::infer::InferCtxt as rustc_trait_selection[719b9ee30517a3be]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  17:     0x7fb5103bb946 - <rustc_trait_selection[719b9ee30517a3be]::solve::normalize::NormalizationFolder<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError>>::normalize_unevaluated_const
  18:     0x7fb5103f177b - <rustc_trait_selection[719b9ee30517a3be]::solve::normalize::NormalizationFolder<rustc_infer[93fa11d9f5df17b1]::traits::engine::ScrubbedTraitError> as rustc_type_ir[fe71196d49a53c54]::fold::FallibleTypeFolder<rustc_middle[2743830fcd413abb]::ty::context::TyCtxt>>::try_fold_const::{closure#0}
  19:     0x7fb5103bc0d6 - <rustc_trait_selection[719b9ee30517a3be]::solve::normalize::DeeplyNormalizeForDiagnosticsFolder as rustc_type_ir[fe71196d49a53c54]::fold::TypeFolder<rustc_middle[2743830fcd413abb]::ty::context::TyCtxt>>::fold_const
  20:     0x7fb510290391 - <rustc_middle[2743830fcd413abb]::ty::Term as rustc_type_ir[fe71196d49a53c54]::fold::TypeFoldable<rustc_middle[2743830fcd413abb]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[719b9ee30517a3be]::solve::normalize::DeeplyNormalizeForDiagnosticsFolder>
  21:     0x7fb512995361 - <rustc_trait_selection[719b9ee30517a3be]::solve::normalize::DeeplyNormalizeForDiagnosticsFolder as rustc_type_ir[fe71196d49a53c54]::fold::TypeFolder<rustc_middle[2743830fcd413abb]::ty::context::TyCtxt>>::fold_predicate.cold
  22:     0x7fb511cc89e5 - rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::derive_errors::find_best_leaf_obligation
  23:     0x7fb511cc7d87 - <rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError as rustc_infer[93fa11d9f5df17b1]::traits::engine::FromSolverError<rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::NextSolverError>>::from_solver_error
  24:     0x7fb511cc7a70 - <core[2e44cabe4492cfed]::iter::adapters::map::Map<core[2e44cabe4492cfed]::iter::adapters::chain::Chain<core[2e44cabe4492cfed]::iter::adapters::map::Map<thin_vec[31f6863a95697a4a]::Drain<rustc_infer[93fa11d9f5df17b1]::traits::Obligation<rustc_middle[2743830fcd413abb]::ty::predicate::Predicate>>, <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError>>::collect_remaining_errors::{closure#0}>, core[2e44cabe4492cfed]::iter::adapters::map::Map<thin_vec[31f6863a95697a4a]::Drain<rustc_infer[93fa11d9f5df17b1]::traits::Obligation<rustc_middle[2743830fcd413abb]::ty::predicate::Predicate>>, <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError>>::collect_remaining_errors::{closure#1}>>, <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError>>::collect_remaining_errors::{closure#2}> as core[2e44cabe4492cfed]::iter::traits::iterator::Iterator>::next
  25:     0x7fb511cc776b - <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError>>::collect_remaining_errors
  26:     0x7fb511cc7679 - <rustc_trait_selection[719b9ee30517a3be]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError> as rustc_infer[93fa11d9f5df17b1]::traits::engine::TraitEngine<rustc_trait_selection[719b9ee30517a3be]::traits::FulfillmentError>>::select_all_or_error
  27:     0x7fb5118c2788 - rustc_trait_selection[719b9ee30517a3be]::traits::coherence::overlap
  28:     0x7fb50dca0a1b - <rustc_middle[2743830fcd413abb]::traits::specialization_graph::Children as rustc_trait_selection[719b9ee30517a3be]::traits::specialize::specialization_graph::ChildrenExt>::insert
  29:     0x7fb510ddc795 - <rustc_middle[2743830fcd413abb]::traits::specialization_graph::Graph as rustc_trait_selection[719b9ee30517a3be]::traits::specialize::specialization_graph::GraphExt>::insert
  30:     0x7fb510dde11f - rustc_trait_selection[719b9ee30517a3be]::traits::specialize::specialization_graph_provider
  31:     0x7fb510dddb25 - rustc_query_impl[72cbea546227b7ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72cbea546227b7ba]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 8usize]>>
  32:     0x7fb510ff1d6f - rustc_query_system[f33c5473bf6e507c]::query::plumbing::try_execute_query::<rustc_query_impl[72cbea546227b7ba]::DynamicConfig<rustc_query_system[f33c5473bf6e507c]::query::caches::DefIdCache<rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[72cbea546227b7ba]::plumbing::QueryCtxt, false>
  33:     0x7fb510f923dd - rustc_query_impl[72cbea546227b7ba]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7fb510f92761 - rustc_hir_analysis[33d6b55adf34d1fa]::coherence::coherent_trait
  35:     0x7fb510f92409 - rustc_query_impl[72cbea546227b7ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72cbea546227b7ba]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7fb51112105e - rustc_query_system[f33c5473bf6e507c]::query::plumbing::try_execute_query::<rustc_query_impl[72cbea546227b7ba]::DynamicConfig<rustc_query_system[f33c5473bf6e507c]::query::caches::DefIdCache<rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[72cbea546227b7ba]::plumbing::QueryCtxt, false>
  37:     0x7fb51111fc8a - rustc_query_impl[72cbea546227b7ba]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7fb5114ae0ee - rustc_hir_analysis[33d6b55adf34d1fa]::check::wfcheck::check_well_formed
  39:     0x7fb5114abfef - rustc_query_impl[72cbea546227b7ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72cbea546227b7ba]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7fb5114ab894 - rustc_query_system[f33c5473bf6e507c]::query::plumbing::try_execute_query::<rustc_query_impl[72cbea546227b7ba]::DynamicConfig<rustc_data_structures[e933edec2325a6de]::vec_cache::VecCache<rustc_span[a74cfce499341739]::def_id::LocalDefId, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[f33c5473bf6e507c]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[72cbea546227b7ba]::plumbing::QueryCtxt, false>
  41:     0x7fb5114ab383 - rustc_query_impl[72cbea546227b7ba]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7fb5114a85e5 - rustc_hir_analysis[33d6b55adf34d1fa]::check::wfcheck::check_mod_type_wf
  43:     0x7fb5114a83df - rustc_query_impl[72cbea546227b7ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72cbea546227b7ba]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7fb511c28819 - rustc_query_system[f33c5473bf6e507c]::query::plumbing::try_execute_query::<rustc_query_impl[72cbea546227b7ba]::DynamicConfig<rustc_query_system[f33c5473bf6e507c]::query::caches::DefaultCache<rustc_span[a74cfce499341739]::def_id::LocalModDefId, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[72cbea546227b7ba]::plumbing::QueryCtxt, false>
  45:     0x7fb511c2858a - rustc_query_impl[72cbea546227b7ba]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7fb510f66332 - rustc_hir_analysis[33d6b55adf34d1fa]::check_crate
  47:     0x7fb51162e81f - rustc_interface[9732b83b5fcd21d3]::passes::run_required_analyses
  48:     0x7fb511b0069e - rustc_interface[9732b83b5fcd21d3]::passes::analysis
  49:     0x7fb511b0066d - rustc_query_impl[72cbea546227b7ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72cbea546227b7ba]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 0usize]>>
  50:     0x7fb511b0617d - rustc_query_system[f33c5473bf6e507c]::query::plumbing::try_execute_query::<rustc_query_impl[72cbea546227b7ba]::DynamicConfig<rustc_query_system[f33c5473bf6e507c]::query::caches::SingleCache<rustc_middle[2743830fcd413abb]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[72cbea546227b7ba]::plumbing::QueryCtxt, false>
  51:     0x7fb511b05e78 - rustc_query_impl[72cbea546227b7ba]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7fb511b2a97e - rustc_interface[9732b83b5fcd21d3]::passes::create_and_enter_global_ctxt::<core[2e44cabe4492cfed]::option::Option<rustc_interface[9732b83b5fcd21d3]::queries::Linker>, rustc_driver_impl[24e7910ed411b030]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  53:     0x7fb511c5931c - rustc_interface[9732b83b5fcd21d3]::interface::run_compiler::<(), rustc_driver_impl[24e7910ed411b030]::run_compiler::{closure#0}>::{closure#1}
  54:     0x7fb511c7c23e - std[fa717b9852406dd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[9732b83b5fcd21d3]::util::run_in_thread_with_globals<rustc_interface[9732b83b5fcd21d3]::util::run_in_thread_pool_with_globals<rustc_interface[9732b83b5fcd21d3]::interface::run_compiler<(), rustc_driver_impl[24e7910ed411b030]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  55:     0x7fb511c7c6b4 - <<std[fa717b9852406dd]::thread::Builder>::spawn_unchecked_<rustc_interface[9732b83b5fcd21d3]::util::run_in_thread_with_globals<rustc_interface[9732b83b5fcd21d3]::util::run_in_thread_pool_with_globals<rustc_interface[9732b83b5fcd21d3]::interface::run_compiler<(), rustc_driver_impl[24e7910ed411b030]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[2e44cabe4492cfed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7fb511c7daab - std::sys::pal::unix::thread::Thread::new::thread_start::h91e3ac4e59384259
  57:     0x7fb50baa370a - <unknown>
  58:     0x7fb50bb27aac - <unknown>
  59:                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.88.0-nightly (3350c1eb3 2025-05-01) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `Maybe`
#1 [coherent_trait] coherence checking all impls of trait `Maybe`
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.MMq3pVFxDMRt/rustc_testrunner_tmpdir_reporting.r7Xb3xN2awRv/mvce.rs:7:1: 7:50>` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

@rustbot label +F-associated_const_equality

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]`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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions