rust-lang / rust-lang/rust

[ICE]: error performing operation: fully_perform: triggered by a sealed supertrait + associated-type-bound subtraits

Open
#162,323 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-associated-items A-higher-ranked A-impl-trait A-inference C-bug I-ICE needs-triage P-medium regression-from-stable-to-nightly S-has-bisection S-has-mcve T-compiler T-types WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I found this ICE when upgrading to +nightly-2026-09-04 (+nightly-2026-06-05 worked fine). I have a crate with a sealed ImplicitBounds = Bounds<&'a Self> + for<'a> supertrait + associated-type-bound subtraits, something in which is triggering the error. I used an LLM to reduce the set of traits to the MRE below:

Code
mod sealed {
    pub trait Sealed: Sized {}
    pub struct Bounds<T>(T);
    impl<T> Sealed for Bounds<T> {}
}
use sealed::{Bounds, Sealed};

trait Op {
    type V;
}

trait Jac: Op {
    fn jacobian(&self, x: &Self::V);
}

trait EqnsRef<'a, ImplicitBounds: Sealed = Bounds<&'a Self>>: Op {
    type Rhs: Op<V = Self::V>;
}

trait Eqns: for<'a> EqnsRef<'a> {
    fn rhs(&self) -> <Self as EqnsRef<'_>>::Rhs;
}

trait EqnsImplicit: Eqns<Rhs: Jac<V = Self::V>> {}
impl<T> EqnsImplicit for T where T: Eqns<Rhs: Jac<V = T::V>> {}

struct MyEqns;
struct MyRhs<'a>(&'a MyEqns);

impl Op for MyRhs<'_> {
    type V = f64;
}
impl Jac for MyRhs<'_> {
    fn jacobian(&self, _x: &f64) {}
}
impl Op for MyEqns {
    type V = f64;
}
impl<'a> EqnsRef<'a> for MyEqns {
    type Rhs = MyRhs<'a>;
}
impl Eqns for MyEqns {
    fn rhs(&self) -> <Self as EqnsRef<'_>>::Rhs {
        MyRhs(self)
    }
}

fn inner() -> impl EqnsImplicit<V = f64> {
    MyEqns
}

pub fn outer() {
    inner().rhs().jacobian(&0.0);
}
Meta

rustc +nightly --version --verbose:

rustc 1.100.0-nightly (0ed41eb41 2026-09-04)
binary: rustc
commit-hash: 0ed41eb4142dda2df61eb1145a312c1a9d62eb56
commit-date: 2026-09-04
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
Error output
❯ RUST_BACKTRACE=1 cargo +nightly build
   Compiling ice-mre v0.0.0 (/home/mrobins/git/tmp/ice-mre)
warning: field `0` is never read
  --> src/lib.rs:28:18
   |
28 | struct MyRhs<'a>(&'a MyEqns);
   |        -----     ^^^^^^^^^^
   |        |
   |        field in this struct
   |
   = help: consider removing this field
   = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

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: error performing operation: fully_perform
  --> src/lib.rs:53:5
   |
53 |     inner().rhs().jacobian(&0.0);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:126:26
         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>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
         5: rustc_borrowck::borrowck_collect_region_constraints
         6: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
         7: rustc_borrowck::mir_borrowck
         8: rustc_query_impl::query_vtables::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
         9: 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>, true>
        10: rustc_query_impl::query_vtables::mir_borrowck::execute_query_incr::__rust_end_short_backtrace
        11: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
        12: rustc_interface::passes::analysis
        13: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, true>
        14: rustc_query_impl::query_vtables::analysis::execute_query_incr::__rust_end_short_backtrace
        15: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
        16: 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}, ()>
        17: <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}
        18: <std::sys::thread::unix::Thread>::new::thread_start
        19: start_thread
                   at ./nptl/pthread_create.c:454:8
        20: clone
                   at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:100:0

  --> src/lib.rs:53:5
   |
53 |     inner().rhs().jacobian(&0.0);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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/mrobins/git/tmp/ice-mre/rustc-ice-2026-09-05T09_39_28-1345463.txt` to your bug report

note: rustc 1.100.0-nightly (0ed41eb41 2026-09-04) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z embed-metadata=no -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `ice-mre` (lib) generated 1 warning
error: could not compile `ice-mre` (lib); 1 warning emitted

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 ICE with the MRE in src/lib.rs by running cargo +nightly build. Start with the delayed-bug location in compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs and the borrow-checking frames in the report. Done means the reduced case no longer produces an internal compiler error and a regression test covers it.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.