rust-lang / rust-lang/rust

[ICE]: `Type system constant with non valtree'able type evaluated but no error emitted`

Open
#161,100 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

snippet:

//@compile-flags: -Znext-solver=globally
#![feature(generic_const_args)]
#![feature(min_generic_const_args)]
trait Trait {
    const F: fn();
}
fn take(_: impl Trait<F = { || {} }>) {}
fn main() {}

Version information

rustc 1.99.0-nightly (a9066b3a6 2026-08-14)
binary: rustc
commit-hash: a9066b3a6e6a0956706c77c49f24a8d258c5ed3b
commit-date: 2026-08-14
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 23.1.0

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

Program output

warning: the feature `generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.PoFXmbFIl8rP/rustc_testrunner_tmpdir_reporting.sr1C89I7U2Sl/mvce.rs:1:12
  |
1 | #![feature(generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #151972 <https://github.com/rust-lang/rust/issues/151972> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.PoFXmbFIl8rP/rustc_testrunner_tmpdir_reporting.sr1C89I7U2Sl/mvce.rs:2:12
  |
2 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information

warning: trait `Trait` is never used
 --> /tmp/icemaker_global_tempdir.PoFXmbFIl8rP/rustc_testrunner_tmpdir_reporting.sr1C89I7U2Sl/mvce.rs:3:7
  |
3 | trait Trait {
  |       ^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `take` is never used
 --> /tmp/icemaker_global_tempdir.PoFXmbFIl8rP/rustc_testrunner_tmpdir_reporting.sr1C89I7U2Sl/mvce.rs:6:4
  |
6 | fn take(_: impl Trait<F = { || {} }>) {}
  |    ^^^^

warning: 4 warnings emitted

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: Type system constant with non valtree'able type evaluated but no error emitted
  |
  = note: delayed at /rustc-dev/a9066b3a6e6a0956706c77c49f24a8d258c5ed3b/compiler/rustc_trait_selection/src/traits/mod.rs:767:39
             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::<&str>
             4: rustc_trait_selection::traits::try_evaluate_const
             5: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_const_and_instantiate_projection_term
             6: <rustc_type_ir::search_graph::SearchGraph<rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<rustc_trait_selection::solve::delegate::SolverDelegate>, rustc_middle::ty::context::TyCtxt>>::evaluate_goal_in_task
             7: <rustc_type_ir::search_graph::SearchGraph<rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<rustc_trait_selection::solve::delegate::SolverDelegate>, rustc_middle::ty::context::TyCtxt>>::evaluate_goal::{closure#0}
             8: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_goal_no_fast_paths
             9: <rustc_trait_selection::solve::delegate::SolverDelegate as rustc_next_trait_solver::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal::{closure#0}
            10: <rustc_next_trait_solver::normalize::NormalizationFolder<rustc_infer::infer::InferCtxt, rustc_middle::ty::context::TyCtxt, rustc_trait_selection::solve::normalize::normalize_with_universes<alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>::{closure#0}>>::normalize_alias_term
            11: <rustc_next_trait_solver::normalize::NormalizationFolder<rustc_infer::infer::InferCtxt, rustc_middle::ty::context::TyCtxt, rustc_trait_selection::solve::normalize::normalize_with_universes<alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>::{closure#0}> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_const::{closure#0}
            12: <rustc_middle::ty::Term as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_next_trait_solver::normalize::NormalizationFolder<rustc_infer::infer::InferCtxt, rustc_middle::ty::context::TyCtxt, rustc_trait_selection::solve::normalize::normalize_with_universes<alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>::{closure#0}>>.cold
            13: <rustc_infer::infer::at::At as rustc_trait_selection::traits::normalize::NormalizeExt>::normalize::<alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>
            14: rustc_trait_selection::traits::do_normalize_clauses
            15: rustc_trait_selection::traits::normalize_param_env_or_error
            16: rustc_ty_utils::ty::param_env
            17: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
            18: rustc_query_impl::query_vtables::param_env::execute_query_non_incr::__rust_end_short_backtrace
            19: rustc_hir_analysis::check::wfcheck::check_item_fn
            20: rustc_hir_analysis::check::check::check_item_type
            21: rustc_hir_analysis::check::wfcheck::check_well_formed
            22: rustc_query_impl::query_vtables::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
            23: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
            24: rustc_query_impl::query_vtables::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
            25: rustc_hir_analysis::check::wfcheck::check_type_wf
            26: rustc_query_impl::query_vtables::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
            27: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
            28: rustc_query_impl::query_vtables::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
            29: rustc_hir_analysis::check_crate
            30: rustc_interface::passes::analysis
            31: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
            32: rustc_query_impl::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
            33: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
            34: 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#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            35: <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#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            36: <std::sys::thread::unix::Thread>::new::thread_start
            37: <unknown>
            38: <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: rustc 1.99.0-nightly (a9066b3a6 2026-08-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-generic_const_args +F-min_generic_const_args

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.

Research direction

Start by running the supplied a.rs reproducer with -Znext-solver=globally and inspect rustc_trait_selection/src/traits/mod.rs around try_evaluate_const, identified in the delayed-bug stack. Trace how the non-valtree-able type system constant is evaluated during well-formedness checking. Done means the reproducer no longer emits an internal compiler error and instead produces the intended diagnostic or behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.