rust-lang / rust-lang/rust

[ICE]: Missing value for constant, but no error reported?

Open
#154,556 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-generic_const_exprs I-ICE S-bug-has-test S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(generic_const_exprs)]

pub trait Foo {
    // Has to take self or a reference to self to ICE.
    fn eq(self);
}

pub trait Bar {
    const NUMBER: usize;
}

impl<T: Bar> Foo for T
where
    [(); T::NUMBER]: Sized, // Bound required for ICE
{
    fn eq(self) {}
}

// As long as the method called below has the same name as the one defined in Foo, the ICE happens.
fn baz() {
    ().eq(&());
}
Meta

rustc --version --verbose:

rustc 1.96.0-nightly (fb27476aa 2026-03-28)
binary: rustc
commit-hash: fb27476aaf1012f1f6ace6306f9b990e0d989c31
commit-date: 2026-03-28
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2
Error output
Caused by:
  process didn't exit successfully: `/home/$USER/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name tes_plugin4 --edition=2024 tes-plugin4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=212 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -Z codegen-backend=cranelift -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=51311448e734f4ca -C extra-filename=-cdce788163fb60de --out-dir /home/$USER/src/rust/bsa/target/debug/deps -C incremental=/home/$USER/src/rust/bsa/target/debug/incremental -L dependency=/home/$USER/src/rust/bsa/target/debug/deps --extern bethesda_types=/home/$USER/src/rust/bsa/target/debug/deps/libbethesda_types-c1bd3ff48f35acf1.rmeta --extern encoding_rs=/home/$USER/src/rust/bsa/target/debug/deps/libencoding_rs-d18754dc19b3efa9.rmeta --extern tracing=/home/$USER/src/rust/bsa/target/debug/deps/libtracing-523dd9bbaedd6df0.rmeta -C link-arg=-fuse-ld=mold` (exit status: 101)
Backtrace

Debug build (cranelift)
delayed bug: Missing value for constant, but no error reported?
   0: ::emit_diagnostic
   1: ::emit_diagnostic
   2: ::emit_producing_guarantee
   3: ::span_delayed_bug::
   4: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable.cold
   5: ::evaluate_root_obligation
   6: rustc_traits::evaluate_obligation::evaluate_obligation
   7: rustc_query_impl::query_impl::evaluate_obligation::invoke_provider_fn::__rust_begin_short_backtrace
   8: rustc_query_impl::execution::try_execute_query::>, rustc_middle::query::erase::ErasedData<[u8; 2]>>, true>
   9: rustc_query_impl::query_impl::evaluate_obligation::execute_query_incr::__rust_end_short_backtrace
  10: ::evaluate_obligation_no_overflow
  11: , ::consider_candidates::{closure#0}>, ::consider_candidates::{closure#1}> as core::iter::traits::iterator::Iterator>::try_fold::<(), core::iter::traits::iterator::Iterator::find::check<(&rustc_hir_typeck::method::probe::Candidate, rustc_hir_typeck::method::probe::ProbeResult), &mut ::consider_candidates::{closure#2}>::{closure#0}, core::ops::control_flow::ControlFlow<(&rustc_hir_typeck::method::probe::Candidate, rustc_hir_typeck::method::probe::ProbeResult)>>
  12: ::pick_method
  13: ::pick_all_method
  14: ::lookup_probe
  15: ::check_expr_method_call
  16: ::check_expr_with_expectation_and_args
  17: ::check_overloaded_binop
  18: ::check_expr_binop
  19: ::check_expr_with_expectation_and_args
  20: ::check_expr_block
  21: ::check_expr_with_expectation_and_args
  22: rustc_hir_typeck::check::check_fn
  23: rustc_hir_typeck::typeck_with_inspect::{closure#0}
  24: rustc_query_impl::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  25: rustc_query_impl::execution::try_execute_query::, rustc_middle::dep_graph::graph::DepNodeIndex>, true>
  26: rustc_query_impl::query_impl::typeck::execute_query_incr::__rust_end_short_backtrace
  27: ::par_hir_body_owners::::{closure#0}
  28: rustc_hir_analysis::check_crate
  29: rustc_interface::passes::analysis
  30: rustc_query_impl::execution::try_execute_query::>, true>
  31: rustc_query_impl::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace
  32: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  33: std::sys::backtrace::__rust_begin_short_backtrace::::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  34: ::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35: ::new::thread_start
  36: 
  37: 

rustc version: 1.96.0-nightly (fb27476aa 2026-03-28)
platform: x86_64-unknown-linux-gnu

Release build (llvm)
delayed bug: Missing value for constant, but no error reported?
   0: ::emit_diagnostic
   1: ::emit_diagnostic
   2: ::emit_producing_guarantee
   3: ::span_delayed_bug::
   4: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable.cold
   5: ::evaluate_root_obligation
   6: rustc_traits::evaluate_obligation::evaluate_obligation
   7: rustc_query_impl::query_impl::evaluate_obligation::invoke_provider_fn::__rust_begin_short_backtrace
   8: rustc_query_impl::execution::try_execute_query::>, rustc_middle::query::erase::ErasedData<[u8; 2]>>, false>
   9: rustc_query_impl::query_impl::evaluate_obligation::execute_query_non_incr::__rust_end_short_backtrace
  10: ::evaluate_obligation_no_overflow
  11: , ::consider_candidates::{closure#0}>, ::consider_candidates::{closure#1}> as core::iter::traits::iterator::Iterator>::try_fold::<(), core::iter::traits::iterator::Iterator::find::check<(&rustc_hir_typeck::method::probe::Candidate, rustc_hir_typeck::method::probe::ProbeResult), &mut ::consider_candidates::{closure#2}>::{closure#0}, core::ops::control_flow::ControlFlow<(&rustc_hir_typeck::method::probe::Candidate, rustc_hir_typeck::method::probe::ProbeResult)>>
  12: ::pick_method
  13: ::pick_all_method
  14: ::lookup_probe
  15: ::check_expr_method_call
  16: ::check_expr_with_expectation_and_args
  17: ::check_overloaded_binop
  18: ::check_expr_binop
  19: ::check_expr_with_expectation_and_args
  20: ::check_expr_block
  21: ::check_expr_with_expectation_and_args
  22: rustc_hir_typeck::check::check_fn
  23: rustc_hir_typeck::typeck_with_inspect::{closure#0}
  24: rustc_query_impl::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  25: rustc_query_impl::execution::try_execute_query::, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
  26: rustc_query_impl::query_impl::typeck::execute_query_non_incr::__rust_end_short_backtrace
  27: ::par_hir_body_owners::::{closure#0}
  28: rustc_hir_analysis::check_crate
  29: rustc_interface::passes::analysis
  30: rustc_query_impl::execution::try_execute_query::>, false>
  31: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  32: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  33: std::sys::backtrace::__rust_begin_short_backtrace::::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  34: ::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35: ::new::thread_start
  36: 
  37: 

rustc version: 1.96.0-nightly (fb27476aa 2026-03-28)
platform: x86_64-unknown-linux-gnu

Unstable features enabled: read_array & generic_const_exprs.

Happens with both debug builds with cranelift and release builds with llvm.

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

Reproduce the provided example with the reported nightly rustc, using both the Cranelift and LLVM builds, and confirm the delayed bug. Start at rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable in the supplied backtrace, then inspect the related obligation evaluation and method-probing path. Done means the example reports a normal compiler diagnostic instead of the delayed internal compiler error.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.