Skip to content

[ICE]: encountered incremental compilation error with explicit_supertraits_containing_assoc_item #158133

@saulvaldelvira

Description

@saulvaldelvira

Rustc nightly (v1.96.0) crashes with an ICE, because of an "incremental compilation error".
Running "cargo clean" fixes the error.

Code

pub trait Visitor<'a> {
    type Result: VisitorResult;
    type Ctx: VisitorCtx<'a>;

    fn get_ctx(&mut self) -> &mut Self::Ctx;

    fn visit_element(&mut self) -> Self::Result {
        self.get_ctx().enter();
        self.get_ctx().exit();
        Self::Result::output()
    }
}

pub trait VisitorResult {
    fn output() -> Self;
}

pub trait VisitorCtx<'a> {
    fn enter(&mut self) {}
    fn exit(&mut self) {}
}

Steps

  • Run cargo +nightly build
  • Remove VisitorCtx::enter
  • Run cargo +nightly build

Meta

rustc --version --verbose:

rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.2

Error output

rustc-ice-2026-06-19T13_53_20-302505.txt

Backtrace

error: internal compiler error: encountered incremental compilation error with explicit_supertraits_containing_assoc_item(401cac20e0f02da1-d02ef62aa90d03a5)
  |
  = note: please follow the instructions below to create a bug report with the provided information
  = note: for incremental compilation bugs, having a reproduction is vital
  = note: an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
  = note: as a workaround, you can run `cargo clean -p err2` or `cargo clean` to allow your project to compile


thread 'rustc' (302507) panicked at /rustc-dev/bc2112ed56c99fa649e09ab3ab286afab3d9059a/compiler/rustc_middle/src/verify_ich.rs:82:9:
Found unstable fingerprints for explicit_supertraits_containing_assoc_item(401cac20e0f02da1-d02ef62aa90d03a5): EarlyBinder { value: [(Binder { value: TraitPredicate(<Self as std::marker::MetaSized>, polarity:Positive), bound_vars: [] }, src/lib.rs:1:1: 12:2 (#12))], .. }
stack backtrace:
   0:     0x7f1180ffd889 - <<std[9155b05baf46f0b5]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[b26e7c5dab710dcd]::fmt::Display>::fmt
   1:     0x7f118160ebde - core[b26e7c5dab710dcd]::fmt::write
   2:     0x7f1181013cb6 - <std[9155b05baf46f0b5]::sys::stdio::unix::Stderr as std[9155b05baf46f0b5]::io::Write>::write_fmt
   3:     0x7f1180fd2b7e - std[9155b05baf46f0b5]::panicking::default_hook::{closure#0}
   4:     0x7f1180ff0573 - std[9155b05baf46f0b5]::panicking::default_hook
   5:     0x7f1180049fc1 - std[9155b05baf46f0b5]::panicking::update_hook::<alloc[4a86d35f348a3b04]::boxed::Box<rustc_driver_impl[b791fc15675dcea2]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1180ff0852 - std[9155b05baf46f0b5]::panicking::panic_with_hook
   7:     0x7f1180fd2c42 - std[9155b05baf46f0b5]::panicking::panic_handler::{closure#0}
   8:     0x7f1180fc7169 - std[9155b05baf46f0b5]::sys::backtrace::__rust_end_short_backtrace::<std[9155b05baf46f0b5]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f1180fd46ad - __rustc[b4c4dac14d05b73]::rust_begin_unwind
  10:     0x7f117df0455c - core[b26e7c5dab710dcd]::panicking::panic_fmt
  11:     0x7f11805f0f46 - rustc_middle[cb7c4bb37f51aac1]::verify_ich::incremental_verify_ich_failed
  12:     0x7f118181ffb8 - rustc_middle[cb7c4bb37f51aac1]::verify_ich::incremental_verify_ich::<rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 16usize]>>
  13:     0x7f1182718f7f - rustc_query_impl[f814d044a8094e2a]::execution::try_execute_query::<rustc_middle[cb7c4bb37f51aac1]::query::caches::DefaultCache<(rustc_span[4065efe3f3bc8177]::def_id::DefId, rustc_span[4065efe3f3bc8177]::symbol::Ident), rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 16usize]>>, true>
  14:     0x7f1182718529 - rustc_query_impl[f814d044a8094e2a]::query_impl::explicit_supertraits_containing_assoc_item::execute_query_incr::__rust_end_short_backtrace
  15:     0x7f11821ec6a9 - <core[b26e7c5dab710dcd]::iter::sources::from_fn::FromFn<rustc_infer[d147af7b5b190580]::traits::util::transitive_bounds_that_define_assoc_item<core[b26e7c5dab710dcd]::iter::adapters::filter_map::FilterMap<core[b26e7c5dab710dcd]::iter::adapters::map::Map<rustc_type_ir[b639ccf59fd3a529]::binder::IterIdentityCopied<rustc_middle[cb7c4bb37f51aac1]::ty::context::TyCtxt, &[(rustc_middle[cb7c4bb37f51aac1]::ty::predicate::Clause, rustc_span[4065efe3f3bc8177]::span_encoding::Span)]>, <rustc_type_ir[b639ccf59fd3a529]::unnormalized::Unnormalized<rustc_middle[cb7c4bb37f51aac1]::ty::context::TyCtxt, (rustc_middle[cb7c4bb37f51aac1]::ty::predicate::Clause, rustc_span[4065efe3f3bc8177]::span_encoding::Span)>>::skip_norm_wip>, <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::probe_single_ty_param_bound_for_assoc_item::{closure#0}::{closure#0}::{closure#0}>>::{closure#0}> as core[b26e7c5dab710dcd]::iter::traits::iterator::Iterator>::next
  16:     0x7f11821e973e - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::probe_single_bound_for_assoc_item::<core[b26e7c5dab710dcd]::iter::sources::from_fn::FromFn<rustc_infer[d147af7b5b190580]::traits::util::transitive_bounds_that_define_assoc_item<core[b26e7c5dab710dcd]::iter::adapters::filter_map::FilterMap<core[b26e7c5dab710dcd]::iter::adapters::map::Map<rustc_type_ir[b639ccf59fd3a529]::binder::IterIdentityCopied<rustc_middle[cb7c4bb37f51aac1]::ty::context::TyCtxt, &[(rustc_middle[cb7c4bb37f51aac1]::ty::predicate::Clause, rustc_span[4065efe3f3bc8177]::span_encoding::Span)]>, <rustc_type_ir[b639ccf59fd3a529]::unnormalized::Unnormalized<rustc_middle[cb7c4bb37f51aac1]::ty::context::TyCtxt, (rustc_middle[cb7c4bb37f51aac1]::ty::predicate::Clause, rustc_span[4065efe3f3bc8177]::span_encoding::Span)>>::skip_norm_wip>, <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::probe_single_ty_param_bound_for_assoc_item::{closure#0}::{closure#0}::{closure#0}>>::{closure#0}>, <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::probe_single_ty_param_bound_for_assoc_item::{closure#0}::{closure#0}>::{closure#0}
  17:     0x7f11821e484c - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::resolve_type_relative_path
  18:     0x7f1181d77a88 - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::lower_type_relative_path::{closure#0}
  19:     0x7f1181d83646 - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::lower_type_relative_ty_path::{closure#0}
  20:     0x7f1181d88864 - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::lower_ty
  21:     0x7f1181d95738 - <dyn rustc_hir_analysis[f8649c0bc5b32aaa]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  22:     0x7f1181d94f14 - rustc_hir_analysis[f8649c0bc5b32aaa]::collect::lower_fn_sig_recovering_infer_ret_ty
  23:     0x7f1181896a8a - rustc_hir_analysis[f8649c0bc5b32aaa]::collect::fn_sig
  24:     0x7f1181896266 - rustc_query_impl[f814d044a8094e2a]::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
  25:     0x7f1181b1444d - rustc_query_impl[f814d044a8094e2a]::execution::try_execute_query::<rustc_middle[cb7c4bb37f51aac1]::query::caches::DefIdCache<rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 24usize]>>, true>
  26:     0x7f11829663d1 - rustc_query_impl[f814d044a8094e2a]::execution::force_query_dep_node::<rustc_middle[cb7c4bb37f51aac1]::query::caches::DefIdCache<rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 24usize]>>>
  27:     0x7f11829662ed - <rustc_query_impl[f814d044a8094e2a]::dep_kind_vtables::make_dep_kind_vtable_for_query<rustc_query_impl[f814d044a8094e2a]::query_impl::fn_sig::VTableGetter>::{closure#0} as core[b26e7c5dab710dcd]::ops::function::FnOnce<(rustc_middle[cb7c4bb37f51aac1]::ty::context::TyCtxt, rustc_middle[cb7c4bb37f51aac1]::dep_graph::dep_node::DepNode, rustc_middle[cb7c4bb37f51aac1]::dep_graph::serialized::SerializedDepNodeIndex)>>::call_once
  28:     0x7f1181623e63 - <rustc_middle[cb7c4bb37f51aac1]::dep_graph::graph::DepGraphData>::try_mark_previous_green
  29:     0x7f11819a888f - rustc_query_impl[f814d044a8094e2a]::execution::ensure_can_skip_execution::<rustc_data_structures[788feccef7b56953]::vec_cache::VecCache<rustc_span[4065efe3f3bc8177]::def_id::LocalDefId, rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[cb7c4bb37f51aac1]::dep_graph::graph::DepNodeIndex>>
  30:     0x7f11819a07ab - rustc_query_impl[f814d044a8094e2a]::query_impl::check_well_formed::execute_query_incr::__rust_end_short_backtrace
  31:     0x7f11824978ff - rustc_hir_analysis[f8649c0bc5b32aaa]::check::wfcheck::check_type_wf
  32:     0x7f11824977c9 - rustc_query_impl[f814d044a8094e2a]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  33:     0x7f11829261e8 - rustc_query_impl[f814d044a8094e2a]::execution::try_execute_query::<rustc_middle[cb7c4bb37f51aac1]::query::caches::SingleCache<rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 1usize]>>, true>
  34:     0x7f1182925b8c - rustc_query_impl[f814d044a8094e2a]::query_impl::check_type_wf::execute_query_incr::__rust_end_short_backtrace
  35:     0x7f1181aa781e - rustc_hir_analysis[f8649c0bc5b32aaa]::check_crate
  36:     0x7f1181aa9d0c - rustc_interface[84e7048b04034882]::passes::analysis
  37:     0x7f11828607c2 - rustc_query_impl[f814d044a8094e2a]::execution::try_execute_query::<rustc_middle[cb7c4bb37f51aac1]::query::caches::SingleCache<rustc_middle[cb7c4bb37f51aac1]::query::erase::ErasedData<[u8; 0usize]>>, true>
  38:     0x7f11828600f7 - rustc_query_impl[f814d044a8094e2a]::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace
  39:     0x7f1182799c52 - rustc_interface[84e7048b04034882]::interface::run_compiler::<(), rustc_driver_impl[b791fc15675dcea2]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f11827ceffa - std[9155b05baf46f0b5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[84e7048b04034882]::util::run_in_thread_with_globals<rustc_interface[84e7048b04034882]::util::run_in_thread_pool_with_globals<rustc_interface[84e7048b04034882]::interface::run_compiler<(), rustc_driver_impl[b791fc15675dcea2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f11827cedad - <std[9155b05baf46f0b5]::thread::lifecycle::spawn_unchecked<rustc_interface[84e7048b04034882]::util::run_in_thread_with_globals<rustc_interface[84e7048b04034882]::util::run_in_thread_pool_with_globals<rustc_interface[84e7048b04034882]::interface::run_compiler<(), rustc_driver_impl[b791fc15675dcea2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b26e7c5dab710dcd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f11827c5290 - <std[9155b05baf46f0b5]::sys::thread::unix::Thread>::new::thread_start
  43:     0x7f117c2981b9 - <unknown>
  44:     0x7f117c31d21c - <unknown>
  45:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

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/err2/rustc-ice-2026-06-19T13_53_20-302505.txt` to your bug report

note: rustc 1.98.0-nightly (bc2112ed5 2026-06-18) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -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:
#0 [explicit_supertraits_containing_assoc_item] computing the super traits of `Visitor` with associated type name `Result`
#1 [fn_sig] computing function signature of `Visitor::visit_element`
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 check_well_formed(err2[950d]::Visitor::visit_element)
end of try_mark_green dep node stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    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