Skip to content

[ICE]: the trait bound .. is not satisfied #153861

@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(const_closures)]
#![feature(const_trait_impl)]
const trait Foo {}
const fn qux<T : [const] Foo>() { (const || {})() }

fn main() {}

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (620e36a8d 2026-03-14)
binary: rustc
commit-hash: 620e36a8d1fc2f9e5694ce83c2631877651a962c
commit-date: 2026-03-14
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Error output

warning: trait `Foo` is never used
 --> crash.rs:3:13
  |
3 | const trait Foo {}
  |             ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `qux` is never used
 --> crash.rs:4:10
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |          ^^^

warning: 2 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[E0277]: the trait bound `(): [const] Foo` is not satisfied
 --> crash.rs:4:35
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |                                   ^^^^^^^^^^^^^^^
  |
note: required by a bound in `qux::{closure#0}`
 --> crash.rs:4:18
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |                  ^^^^^^^^^^^ required by this bound in `qux::{closure#0}`
note: delayed at /rustc-dev/620e36a8d1fc2f9e5694ce83c2631877651a962c/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:864:24
...
Backtrace

warning: trait `Foo` is never used
 --> crash.rs:3:13
  |
3 | const trait Foo {}
  |             ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `qux` is never used
 --> crash.rs:4:10
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |          ^^^

warning: 2 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[E0277]: the trait bound `(): [const] Foo` is not satisfied
 --> crash.rs:4:35
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |                                   ^^^^^^^^^^^^^^^
  |
note: required by a bound in `qux::{closure#0}`
 --> crash.rs:4:18
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |                  ^^^^^^^^^^^ required by this bound in `qux::{closure#0}`
note: delayed at /rustc-dev/620e36a8d1fc2f9e5694ce83c2631877651a962c/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:864:24
         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_trait_selection::error_reporting::TypeErrCtxt>::report_selection_error
         4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
         5: rustc_hir_typeck::typeck_with_inspect::{closure#0}
         6: rustc_query_impl::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
         7: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
         8: rustc_query_impl::query_impl::typeck::execute_query_non_incr::__rust_end_short_backtrace
         9: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
        10: rustc_hir_analysis::check_crate
        11: rustc_interface::passes::analysis
        12: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        13: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        14: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        15: 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}, ()>
        16: <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}
        17: <std::sys::thread::unix::Thread>::new::thread_start
        18: <unknown>
        19: <unknown>

 --> crash.rs:4:35
  |
4 | const fn qux<T : [const] Foo>() { (const || {})() }
  |                                   ^^^^^^^^^^^^^^^

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/rustc-ice-2026-03-14T11_15_16-222635.txt` to your bug report

note: rustc 1.96.0-nightly (620e36a8d 2026-03-14) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-const_closures`#![feature(const_closures)]`F-const_trait_impl`#![feature(const_trait_impl)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️PG-const-traitsProject group: Const traitsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    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