Skip to content

[ICE]: invalid float op: AddWithOverflow #156780

@matthiaskrgr

Description

@matthiaskrgr

Code

// -Znext-solver=globally
#![feature(min_generic_const_args, generic_const_args, generic_const_items)]
type const ADD1< const N : usize > : usize = const {N + 1};
impl [(); ADD1::<1f64>] {}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.97.0-nightly (e50aa6fba 2026-05-19)
binary: rustc
commit-hash: e50aa6fba4e63ab34c72bf9acfd2c307c1155d1a
commit-date: 2026-05-19
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Error output

<output>
Backtrace

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

warning: the feature `generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> b.rs:1:36
  |
1 | #![feature(min_generic_const_args, generic_const_args, generic_const_items)]
  |                                    ^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #151972 <https://github.com/rust-lang/rust/issues/151972> for more information

warning: the feature `generic_const_items` is incomplete and may not be safe to use and/or cause compiler crashes
 --> b.rs:1:56
  |
1 | #![feature(min_generic_const_args, generic_const_args, generic_const_items)]
  |                                                        ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information

error: internal compiler error: /rustc-dev/e50aa6fba4e63ab34c72bf9acfd2c307c1155d1a/compiler/rustc_const_eval/src/interpret/operator.rs:80:18: invalid float op: `AddWithOverflow`
 --> b.rs:2:53
  |
2 | type const ADD1< const N : usize > : usize = const {N + 1};
  |                                                     ^^^^^


thread 'rustc' (833216) panicked at /rustc-dev/e50aa6fba4e63ab34c72bf9acfd2c307c1155d1a/compiler/rustc_const_eval/src/interpret/operator.rs:80:18:
Box<dyn Any>
stack backtrace:
   0:     0x7fa9dd495fd9 - <<std[d28b1718532fa52a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[667c7a611d73a360]::fmt::Display>::fmt
   1:     0x7fa9ddc1ff88 - core[667c7a611d73a360]::fmt::write
   2:     0x7fa9dd4accc6 - <std[d28b1718532fa52a]::sys::stdio::unix::Stderr as std[d28b1718532fa52a]::io::Write>::write_fmt
   3:     0x7fa9dd46c1fe - std[d28b1718532fa52a]::panicking::default_hook::{closure#0}
   4:     0x7fa9dd489913 - std[d28b1718532fa52a]::panicking::default_hook
   5:     0x7fa9dc288bd1 - std[d28b1718532fa52a]::panicking::update_hook::<alloc[87b0fb19d3271c63]::boxed::Box<rustc_driver_impl[c5815a579428c92a]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fa9dd489bf2 - std[d28b1718532fa52a]::panicking::panic_with_hook
   7:     0x7fa9dc2b64a1 - std[d28b1718532fa52a]::panicking::begin_panic::<rustc_errors[5f6471fb26749c51]::ExplicitBug>::{closure#0}
   8:     0x7fa9dc2af496 - std[d28b1718532fa52a]::sys::backtrace::__rust_end_short_backtrace::<std[d28b1718532fa52a]::panicking::begin_panic<rustc_errors[5f6471fb26749c51]::ExplicitBug>::{closure#0}, !>
   9:     0x7fa9dc2af1fb - std[d28b1718532fa52a]::panicking::begin_panic::<rustc_errors[5f6471fb26749c51]::ExplicitBug>
  10:     0x7fa9dc2c1981 - <rustc_errors[5f6471fb26749c51]::diagnostic::BugAbort as rustc_errors[5f6471fb26749c51]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fa9dc925f8c - <rustc_errors[5f6471fb26749c51]::DiagCtxtHandle>::span_bug::<rustc_span[4e3b3972b45ab341]::span_encoding::Span, alloc[87b0fb19d3271c63]::string::String>
  12:     0x7fa9dc951776 - rustc_middle[e3a9e155868aba9f]::util::bug::opt_span_bug_fmt::<rustc_span[4e3b3972b45ab341]::span_encoding::Span>::{closure#0}
  13:     0x7fa9dc951902 - rustc_middle[e3a9e155868aba9f]::ty::context::tls::with_opt::<rustc_middle[e3a9e155868aba9f]::util::bug::opt_span_bug_fmt<rustc_span[4e3b3972b45ab341]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7fa9dc94039b - rustc_middle[e3a9e155868aba9f]::ty::context::tls::with_context_opt::<rustc_middle[e3a9e155868aba9f]::ty::context::tls::with_opt<rustc_middle[e3a9e155868aba9f]::util::bug::opt_span_bug_fmt<rustc_span[4e3b3972b45ab341]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7fa9da151248 - rustc_middle[e3a9e155868aba9f]::util::bug::span_bug_fmt::<rustc_span[4e3b3972b45ab341]::span_encoding::Span>
  16:     0x7fa9dde90353 - <rustc_const_eval[3a555f2a23c9db6b]::interpret::eval_context::InterpCx<rustc_const_eval[3a555f2a23c9db6b]::const_eval::machine::CompileTimeMachine>>::binary_op
  17:     0x7fa9db48278e - <rustc_const_eval[3a555f2a23c9db6b]::interpret::eval_context::InterpCx<rustc_const_eval[3a555f2a23c9db6b]::const_eval::machine::CompileTimeMachine>>::eval_rvalue_into_place
  18:     0x7fa9db47aa31 - rustc_const_eval[3a555f2a23c9db6b]::const_eval::eval_queries::eval_to_allocation_raw_provider
  19:     0x7fa9de2c9416 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
  20:     0x7fa9de2c8a9d - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_middle[e3a9e155868aba9f]::query::caches::DefaultCache<rustc_middle[e3a9e155868aba9f]::ty::PseudoCanonicalInput<rustc_middle[e3a9e155868aba9f]::mir::interpret::GlobalId>, rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 24usize]>>, false>
  21:     0x7fa9de2c8487 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::eval_to_allocation_raw::execute_query_non_incr::__rust_end_short_backtrace
  22:     0x7fa9de2c5da7 - rustc_const_eval[3a555f2a23c9db6b]::const_eval::valtrees::eval_to_valtree
  23:     0x7fa9de2c5b26 - <rustc_const_eval[3a555f2a23c9db6b]::provide::{closure#0} as core[667c7a611d73a360]::ops::function::FnOnce<(rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt, rustc_middle[e3a9e155868aba9f]::ty::PseudoCanonicalInput<rustc_middle[e3a9e155868aba9f]::mir::interpret::GlobalId>)>>::call_once
  24:     0x7fa9de2c5aec - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::eval_to_valtree::invoke_provider_fn::__rust_begin_short_backtrace
  25:     0x7fa9de79abf0 - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_middle[e3a9e155868aba9f]::query::caches::DefaultCache<rustc_middle[e3a9e155868aba9f]::ty::PseudoCanonicalInput<rustc_middle[e3a9e155868aba9f]::mir::interpret::GlobalId>, rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 16usize]>>, false>
  26:     0x7fa9de79a7fe - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::eval_to_valtree::execute_query_non_incr::__rust_end_short_backtrace
  27:     0x7fa9da42ef66 - <rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  28:     0x7fa9de2032c9 - rustc_trait_selection[7d28cc6e49d7fc92]::traits::try_evaluate_const
  29:     0x7fa9deabff64 - <rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate, rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>>::evaluate_const_and_instantiate_normalizes_to_term
  30:     0x7fa9deac3bde - <rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate> as rustc_type_ir[7dd32e9aabe7f86f]::search_graph::Delegate>::compute_goal::{closure#0}
  31:     0x7fa9da4192ac - <rustc_type_ir[7dd32e9aabe7f86f]::search_graph::SearchGraph<rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate>, rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}
  32:     0x7fa9de22935f - <rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate, rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>>::evaluate_goal_raw
  33:     0x7fa9de22577c - <rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate, rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>>::evaluate_added_goals_step
  34:     0x7fa9deac3466 - <rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate> as rustc_type_ir[7dd32e9aabe7f86f]::search_graph::Delegate>::compute_goal::{closure#0}
  35:     0x7fa9deac129f - <rustc_type_ir[7dd32e9aabe7f86f]::search_graph::SearchGraph<rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate>, rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt>>::evaluate_goal_in_task
  36:     0x7fa9deac0dbe - rustc_trait_selection[7d28cc6e49d7fc92]::solve::evaluate_root_goal_for_proof_tree_raw
  37:     0x7fa9deac0bf2 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::evaluate_root_goal_for_proof_tree_raw::invoke_provider_fn::__rust_begin_short_backtrace
  38:     0x7fa9deab0f59 - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_middle[e3a9e155868aba9f]::query::caches::DefaultCache<rustc_type_ir[7dd32e9aabe7f86f]::canonical::CanonicalQueryInput<rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt, rustc_type_ir[7dd32e9aabe7f86f]::solve::QueryInput<rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt, rustc_middle[e3a9e155868aba9f]::ty::predicate::Predicate>>, rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 48usize]>>, false>
  39:     0x7fa9deab0b81 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::evaluate_root_goal_for_proof_tree_raw::execute_query_non_incr::__rust_end_short_backtrace
  40:     0x7fa9db1e98b9 - <rustc_middle[e3a9e155868aba9f]::ty::context::TyCtxt as rustc_type_ir[7dd32e9aabe7f86f]::interner::Interner>::evaluate_root_goal_for_proof_tree_raw
  41:     0x7fa9dec2fd76 - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::delegate::SolverDelegate as rustc_next_trait_solver[d7ff61c40a8c5c4]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal_for_proof_tree
  42:     0x7fa9dec2e9e5 - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::inspect::analyse::InspectCandidate>::instantiate_proof_tree_for_nested_goal
  43:     0x7fa9dec2e50c - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::inspect::analyse::InspectCandidate>::instantiate_nested_goals
  44:     0x7fa9dec33213 - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::derive_errors::BestObligation as rustc_trait_selection[7d28cc6e49d7fc92]::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
  45:     0x7fa9dec333a8 - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::derive_errors::BestObligation as rustc_trait_selection[7d28cc6e49d7fc92]::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
  46:     0x7fa9dec32ed0 - <rustc_infer[62626348322ffe83]::infer::InferCtxt as rustc_trait_selection[7d28cc6e49d7fc92]::solve::inspect::analyse::InferCtxtProofTreeExt>::visit_proof_tree_at_depth::<rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::derive_errors::BestObligation>
  47:     0x7fa9deaae8b6 - rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::derive_errors::find_best_leaf_obligation
  48:     0x7fa9deaadf22 - <rustc_trait_selection[7d28cc6e49d7fc92]::traits::FulfillmentError as rustc_infer[62626348322ffe83]::traits::engine::FromSolverError<rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::NextSolverError>>::from_solver_error
  49:     0x7fa9de402c6e - <rustc_trait_selection[7d28cc6e49d7fc92]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[7d28cc6e49d7fc92]::traits::FulfillmentError> as rustc_infer[62626348322ffe83]::traits::engine::TraitEngine<rustc_trait_selection[7d28cc6e49d7fc92]::traits::FulfillmentError>>::try_evaluate_obligations
  50:     0x7fa9de4053dd - <rustc_hir_analysis[27343079e22cc89a]::check::wfcheck::WfCheckingCtxt>::deeply_normalize::<rustc_middle[e3a9e155868aba9f]::ty::Ty>
  51:     0x7fa9de41dc02 - rustc_hir_analysis[27343079e22cc89a]::check::wfcheck::check_impl
  52:     0x7fa9de46746a - rustc_hir_analysis[27343079e22cc89a]::check::check::check_item_type
  53:     0x7fa9de463b5c - rustc_hir_analysis[27343079e22cc89a]::check::wfcheck::check_well_formed
  54:     0x7fa9de463b37 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  55:     0x7fa9de463126 - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_data_structures[325bf46a3adac132]::vec_cache::VecCache<rustc_span[4e3b3972b45ab341]::def_id::LocalDefId, rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[e3a9e155868aba9f]::dep_graph::graph::DepNodeIndex>, false>
  56:     0x7fa9de462ebb - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  57:     0x7fa9de45fba9 - rustc_hir_analysis[27343079e22cc89a]::check::wfcheck::check_type_wf
  58:     0x7fa9de45fab9 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  59:     0x7fa9ded8ce5c - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_middle[e3a9e155868aba9f]::query::caches::SingleCache<rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 1usize]>>, false>
  60:     0x7fa9ded8cc37 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  61:     0x7fa9ddee7be9 - rustc_hir_analysis[27343079e22cc89a]::check_crate
  62:     0x7fa9ddee3561 - rustc_interface[89e8c22ed996d79b]::passes::analysis
  63:     0x7fa9ded8c209 - rustc_query_impl[a4e2c3aab8bd2df]::execution::try_execute_query::<rustc_middle[e3a9e155868aba9f]::query::caches::SingleCache<rustc_middle[e3a9e155868aba9f]::query::erase::ErasedData<[u8; 0usize]>>, false>
  64:     0x7fa9ded8bee9 - rustc_query_impl[a4e2c3aab8bd2df]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  65:     0x7fa9deda55db - rustc_interface[89e8c22ed996d79b]::interface::run_compiler::<(), rustc_driver_impl[c5815a579428c92a]::run_compiler::{closure#0}>::{closure#1}
  66:     0x7fa9ded76e40 - std[d28b1718532fa52a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[89e8c22ed996d79b]::util::run_in_thread_with_globals<rustc_interface[89e8c22ed996d79b]::util::run_in_thread_pool_with_globals<rustc_interface[89e8c22ed996d79b]::interface::run_compiler<(), rustc_driver_impl[c5815a579428c92a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  67:     0x7fa9ded7752d - <std[d28b1718532fa52a]::thread::lifecycle::spawn_unchecked<rustc_interface[89e8c22ed996d79b]::util::run_in_thread_with_globals<rustc_interface[89e8c22ed996d79b]::util::run_in_thread_pool_with_globals<rustc_interface[89e8c22ed996d79b]::interface::run_compiler<(), rustc_driver_impl[c5815a579428c92a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[667c7a611d73a360]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  68:     0x7fa9ded7832c - <std[d28b1718532fa52a]::sys::thread::unix::Thread>::new::thread_start
  69:     0x7fa9d82981b9 - <unknown>
  70:     0x7fa9d831d21c - <unknown>
  71:                0x0 - <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 `/tmp/im/4/rustc-ice-2026-05-20T16_22_25-833206.txt` to your bug report

note: rustc 1.97.0-nightly (e50aa6fba 2026-05-19) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `ADD1::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [evaluate_root_goal_for_proof_tree_raw] computing proof tree for `^c_BoundConst { var: 0, .. } == const {N + 1}`
#3 [check_well_formed] checking that `<impl at b.rs:3:1: 3:24>` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `b`
end of query stack
error: aborting due to 1 previous error; 3 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-generic_const_args`#![feature(generic_const_args)]`F-generic_const_items`#![feature(generic_const_items)]`F-min_generic_const_args`#![feature(min_generic_const_args)]`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)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions