Skip to content

ICE / hang found DefPathHash collision between DefPath #143697

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

trait Output<T> {
    type Output;
}


trait X {
    fn a() -> impl Sized<(), Output = impl Sized<Vec<[u8]>>>;

    fn a() -> impl Sized<(), Output = impl Sized<Vec<[u8]>>>;

    fn a() -> impl Sized<(), Display = impl Sized<Output<u8>>>;
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.90.0-nightly (6b3ae3f6e 2025-07-09)
binary: rustc
commit-hash: 6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34
commit-date: 2025-07-09
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.7

Error output

error[E0428]: the name `a` is defined multiple times
 --> a.rs:9:5
  |
7 |     fn a() -> impl Sized<(), Output = impl Sized<Vec<[u8]>>>;
  |     --------------------------------------------------------- previous definition of the value `a` here
8 |
9 |     fn a() -> impl Sized<(), Output = impl Sized<Vec<[u8]>>>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here
  |
  = note: `a` must be defined only once in the value namespace of this trait

error[E0428]: the name `a` is defined multiple times
  --> a.rs:11:5
   |
7  |     fn a() -> impl Sized<(), Output = impl Sized<Vec<[u8]>>>;
   |     --------------------------------------------------------- previous definition of the value `a` here
...
11 |     fn a() -> impl Sized<(), Display = impl Sized<Output<u8>>>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here
   |
   = note: `a` must be defined only once in the value namespace of this trait
Backtrace



thread 'rustc' panicked at compiler/rustc_hir/src/definitions.rs:70:13:
found DefPathHash collision between DefPath {
    data: [
        DisambiguatedDefPathData {
            data: TypeNs(
                "X",
            ),
            disambiguator: 0,
        },
        DisambiguatedDefPathData {
            data: AnonAssocTy(
                "a",
            ),
            disambiguator: 3,
        },
    ],
    krate: crate0,
} and DefPath {
    data: [
        DisambiguatedDefPathData {
            data: TypeNs(
                "X",
            ),
            disambiguator: 0,
        },
        DisambiguatedDefPathData {
            data: AnonAssocTy(
                "a",
            ),
            disambiguator: 3,
        },
    ],
    krate: crate0,
}. Compilation cannot continue.
stack backtrace:
   0:     0x7543cc9af6f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8ccd6d637109b1d3
   1:     0x7543cd2025f7 - core::fmt::write::hc53026627f361f4c
   2:     0x7543cc9a5223 - std::io::Write::write_fmt::he0604e7c2e9707b7
   3:     0x7543cc9af552 - std::sys::backtrace::BacktraceLock::print::h3189b00c9fe2c48c
   4:     0x7543cc9b2ff7 - std::panicking::default_hook::{{closure}}::h534f1f9ab42146dc
   5:     0x7543cc9b2b5b - std::panicking::default_hook::h0285f28ab2202ac2
   6:     0x7543cba51393 - std[26476b4b5e24f03f]::panicking::update_hook::<alloc[349ed8f87288922e]::boxed::Box<rustc_driver_impl[a26212666416ae3c]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7543cc9b383b - std::panicking::rust_panic_with_hook::hceb7d360e287ad47
   8:     0x7543cc9b353a - std::panicking::begin_panic_handler::{{closure}}::h977564ccd46b86ab
   9:     0x7543cc9afbc9 - std::sys::backtrace::__rust_end_short_backtrace::h68051c399ed9ae5d
  10:     0x7543cc9b321d - __rustc[365f28b82031a682]::rust_begin_unwind
  11:     0x7543c90e07d0 - core::panicking::panic_fmt::heb2d3b3aec3bb6b8
  12:     0x7543cd95a1ef - <rustc_middle[e68d91ead2495186]::ty::context::TyCtxt>::create_def
  13:     0x7543cd9564e8 - <rustc_middle[e68d91ead2495186]::query::plumbing::TyCtxtAt>::create_def
  14:     0x7543cc8f6c03 - rustc_ty_utils[d2e8b753067980c7]::assoc::associated_type_for_impl_trait_in_trait
  15:     0x7543cc8f6943 - <rustc_ty_utils[d2e8b753067980c7]::assoc::RPITVisitor as rustc_hir[27857c4ec092326d]::intravisit::Visitor>::visit_opaque_ty
  16:     0x7543cdcb54ec - rustc_ty_utils[d2e8b753067980c7]::assoc::associated_types_for_impl_traits_in_associated_fn
  17:     0x7543cdcb4eec - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 16usize]>>
  18:     0x7543cdcb4eb7 - <rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2} as core[a0c6e5e304bc8aad]::ops::function::FnOnce<(rustc_middle[e68d91ead2495186]::ty::context::TyCtxt, rustc_span[baae63ed02fe6a15]::def_id::DefId)>>::call_once
  19:     0x7543cd3779fb - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_query_system[8d81dc6dab7459d8]::query::caches::DefIdCache<rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  20:     0x7543cd377228 - rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_types_for_impl_traits_in_associated_fn::get_query_non_incr::__rust_end_short_backtrace
  21:     0x7543ce3261f6 - <core[a0c6e5e304bc8aad]::iter::adapters::GenericShunt<core[a0c6e5e304bc8aad]::iter::adapters::map::Map<core[a0c6e5e304bc8aad]::iter::adapters::chain::Chain<core[a0c6e5e304bc8aad]::iter::adapters::map::Map<core[a0c6e5e304bc8aad]::slice::iter::Iter<rustc_hir[27857c4ec092326d]::hir::TraitItemRef>, rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#0}>, core[a0c6e5e304bc8aad]::iter::adapters::copied::Copied<core[a0c6e5e304bc8aad]::iter::adapters::flatten::FlatMap<core[a0c6e5e304bc8aad]::iter::adapters::filter::Filter<core[a0c6e5e304bc8aad]::slice::iter::Iter<rustc_hir[27857c4ec092326d]::hir::TraitItemRef>, rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#1}>, &[rustc_span[baae63ed02fe6a15]::def_id::DefId], rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#2}>>>, core[a0c6e5e304bc8aad]::result::Result<rustc_span[baae63ed02fe6a15]::def_id::DefId, !>::Ok>, core[a0c6e5e304bc8aad]::result::Result<core[a0c6e5e304bc8aad]::convert::Infallible, !>> as core[a0c6e5e304bc8aad]::iter::traits::iterator::Iterator>::next
  22:     0x7543ce325efc - rustc_arena[5fe13a6180bd3d26]::outline::<<rustc_arena[5fe13a6180bd3d26]::DroplessArena>::alloc_from_iter<rustc_span[baae63ed02fe6a15]::def_id::DefId, core[a0c6e5e304bc8aad]::iter::adapters::chain::Chain<core[a0c6e5e304bc8aad]::iter::adapters::map::Map<core[a0c6e5e304bc8aad]::slice::iter::Iter<rustc_hir[27857c4ec092326d]::hir::TraitItemRef>, rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#0}>, core[a0c6e5e304bc8aad]::iter::adapters::copied::Copied<core[a0c6e5e304bc8aad]::iter::adapters::flatten::FlatMap<core[a0c6e5e304bc8aad]::iter::adapters::filter::Filter<core[a0c6e5e304bc8aad]::slice::iter::Iter<rustc_hir[27857c4ec092326d]::hir::TraitItemRef>, rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#1}>, &[rustc_span[baae63ed02fe6a15]::def_id::DefId], rustc_ty_utils[d2e8b753067980c7]::assoc::associated_item_def_ids::{closure#2}>>>>::{closure#0}, &mut [rustc_span[baae63ed02fe6a15]::def_id::DefId]>
  23:     0x7543cd37709f - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_item_def_ids::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 16usize]>>
  24:     0x7543cd376e27 - <rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_item_def_ids::dynamic_query::{closure#2} as core[a0c6e5e304bc8aad]::ops::function::FnOnce<(rustc_middle[e68d91ead2495186]::ty::context::TyCtxt, rustc_span[baae63ed02fe6a15]::def_id::DefId)>>::call_once
  25:     0x7543cd3779fb - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_query_system[8d81dc6dab7459d8]::query::caches::DefIdCache<rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  26:     0x7543cd37749e - rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_item_def_ids::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7543cd38d1f7 - rustc_ty_utils[d2e8b753067980c7]::assoc::associated_items
  28:     0x7543cd38ce8c - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7543cd216ee5 - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_query_system[8d81dc6dab7459d8]::query::caches::DefIdCache<rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  30:     0x7543cd216321 - rustc_query_impl[8ffce37a6b3e6334]::query_impl::associated_items::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7543cdaba8b0 - rustc_hir_analysis[5870297b7aedcd8f]::check::check::check_item_type
  32:     0x7543cdaafd35 - rustc_hir_analysis[5870297b7aedcd8f]::check::wfcheck::check_well_formed
  33:     0x7543cdaafd17 - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7543cdaaf54c - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_data_structures[33b9671b136d4fc7]::vec_cache::VecCache<rustc_span[baae63ed02fe6a15]::def_id::LocalDefId, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[8d81dc6dab7459d8]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  35:     0x7543cdaaf082 - rustc_query_impl[8ffce37a6b3e6334]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7543cdaab2a4 - rustc_hir_analysis[5870297b7aedcd8f]::check::wfcheck::check_type_wf
  37:     0x7543cdaab1b3 - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 1usize]>>
  38:     0x7543ce2bfe3c - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_query_system[8d81dc6dab7459d8]::query::caches::SingleCache<rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  39:     0x7543ce2bfc36 - rustc_query_impl[8ffce37a6b3e6334]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7543cd9a71e0 - rustc_hir_analysis[5870297b7aedcd8f]::check_crate
  41:     0x7543cdb3a5a3 - rustc_interface[755e80e928d14199]::passes::analysis
  42:     0x7543cdb3a1b5 - rustc_query_impl[8ffce37a6b3e6334]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8ffce37a6b3e6334]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 0usize]>>
  43:     0x7543ce2c15bc - rustc_query_system[8d81dc6dab7459d8]::query::plumbing::try_execute_query::<rustc_query_impl[8ffce37a6b3e6334]::DynamicConfig<rustc_query_system[8d81dc6dab7459d8]::query::caches::SingleCache<rustc_middle[e68d91ead2495186]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[8ffce37a6b3e6334]::plumbing::QueryCtxt, false>
  44:     0x7543ce2c1186 - rustc_query_impl[8ffce37a6b3e6334]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7543ce4fab96 - rustc_interface[755e80e928d14199]::passes::create_and_enter_global_ctxt::<core[a0c6e5e304bc8aad]::option::Option<rustc_interface[755e80e928d14199]::queries::Linker>, rustc_driver_impl[a26212666416ae3c]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  46:     0x7543ce51a657 - rustc_interface[755e80e928d14199]::interface::run_compiler::<(), rustc_driver_impl[a26212666416ae3c]::run_compiler::{closure#0}>::{closure#1}
  47:     0x7543ce3ed8b8 - std[26476b4b5e24f03f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[755e80e928d14199]::util::run_in_thread_with_globals<rustc_interface[755e80e928d14199]::util::run_in_thread_pool_with_globals<rustc_interface[755e80e928d14199]::interface::run_compiler<(), rustc_driver_impl[a26212666416ae3c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  48:     0x7543ce3ed596 - <<std[26476b4b5e24f03f]::thread::Builder>::spawn_unchecked_<rustc_interface[755e80e928d14199]::util::run_in_thread_with_globals<rustc_interface[755e80e928d14199]::util::run_in_thread_pool_with_globals<rustc_interface[755e80e928d14199]::interface::run_compiler<(), rustc_driver_impl[a26212666416ae3c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a0c6e5e304bc8aad]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7543ce3f34bd - std::sys::pal::unix::thread::Thread::new::thread_start::h73b3408c330049d3
  50:     0x7543c7ca57eb - <unknown>
  51:     0x7543c7d2918c - <unknown>
  52:                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/im/rustc-ice-2025-07-09T16_45_12-2537805.txt` to your bug report

query stack during panic:

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions