rust-lang / rust-lang/rust

[ICE]: assumptions on binders: `could not find the supertrait vtable slot`

Open
#157,859 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

-Zassumptions-on-binders C-bug I-ICE needs-triage T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code
//@compile-flags: -Zassumptions-on-binders  -Znext-solver=globally
trait Super<U> {
    fn a(&self) {
        let a: &dyn Sub = &();
        let b: &dyn Super<for<'a> fn(&'a ())> = a;
    }
}
impl<T> Super<T> for () {}
trait Sub: Super<fn(&'static ())> {}
impl Sub for () {}
fn main() {
    let a: &dyn Sub = &();
}

Meta

rustc --version --verbose:

rustc 1.98.0-nightly (4e391cf24 2026-06-12)
binary: rustc
commit-hash: 4e391cf2425cf96521af17ff460e9f220e9bca00
commit-date: 2026-06-12
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6
Error output
warning: unused variable: `b`
 --> code.rs:4:13
  |
4 |         let b: &dyn Super<for<'a> fn(&'a ())> = a;
  |             ^ help: if this is intentional, prefix it with an underscore: `_b`
  |
  = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

warning: unused variable: `a`
  --> code.rs:11:9
   |
11 |     let a: &dyn Sub = &();
   |         ^ help: if this is intentional, prefix it with an underscore: `_a`

warning: method `a` is never used
 --> code.rs:2:8
  |
1 | trait Super<U> {
  |       ----- method in this trait
2 |     fn a(&self) {
  |        ^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: 3 warnings emitted
Backtrace

...
warning: method `a` is never used
 --> code.rs:2:8
  |
1 | trait Super<U> {
  |       ----- method in this trait
2 |     fn a(&self) {
  |        ^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: 3 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: could not find the supertrait vtable slot for `dyn Sub` -> `dyn Super<for<'a> fn(&'a ())>`
  |
  = note: delayed at /rustc-dev/4e391cf2425cf96521af17ff460e9f220e9bca00/compiler/rustc_trait_selection/src/traits/vtable.rs:434:19
             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::<alloc::string::String>
             4: rustc_trait_selection::traits::vtable::supertrait_vtable_slot
             5: rustc_query_impl::query_impl::supertrait_vtable_slot::invoke_provider_fn::__rust_begin_short_backtrace
             6: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefaultCache<(rustc_middle::ty::Ty, rustc_middle::ty::Ty), rustc_middle::query::erase::ErasedData<[u8; 16]>>, false>
             7: rustc_query_impl::query_impl::supertrait_vtable_slot::execute_query_non_incr::__rust_end_short_backtrace
             8: rustc_codegen_ssa::base::unsize_ptr::<rustc_codegen_llvm::builder::GenericBuilder<rustc_codegen_llvm::context::FullCx>>
             9: <rustc_codegen_ssa::mir::FunctionCx<rustc_codegen_llvm::builder::GenericBuilder<rustc_codegen_llvm::context::FullCx>>>::codegen_rvalue_operand
            10: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::GenericBuilder<rustc_codegen_llvm::context::FullCx>>
            11: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
            12: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
            13: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend, rustc_codegen_llvm::ModuleLlvm>
            14: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
            15: <rustc_interface::queries::Linker>::codegen_and_build_linker
            16: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            17: 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}, ()>
            18: <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}
            19: <std::sys::thread::unix::Thread>::new::thread_start
            20: <unknown>
            21: <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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-06-13T10_56_31-4076222.txt` to your bug report

note: rustc 1.98.0-nightly (4e391cf24 2026-06-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z assumptions-on-binders -Z next-solver=globally

query stack during panic:
end of query stack

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 a nightly compiler using -Zassumptions-on-binders and -Znext-solver=globally. Then inspect compiler/rustc_trait_selection/src/traits/vtable.rs around line 434 and the supertrait_vtable_slot path; done means the example no longer emits an 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.