Skip to content

ICE / Hang found DefPathHash collision between DefPath #140796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue May 8, 2025 · 3 comments
Open

ICE / Hang found DefPathHash collision between DefPath #140796

matthiaskrgr opened this issue May 8, 2025 · 3 comments
Labels
C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

trait Trait {}

trait Bar {
    fn method() -> impl Sized;
    async fn method() -> Result<(), ()>;

}

fn foo<T: Trait<method(): Send>>(hc: HC) {
    needs_trait(T::method());
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (197387201 2025-05-08)
binary: rustc
commit-hash: 19738720130a82959acd4fc45259166262f3ffbe
commit-date: 2025-05-08
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.4

Error output

<output>
Backtrace

thread 'rustc' panicked at compiler/rustc_hir/src/definitions.rs:70:13:
found DefPathHash collision between DefPath {
    data: [
        DisambiguatedDefPathData {
            data: TypeNs(
                "Bar",
            ),
            disambiguator: 0,
        },
        DisambiguatedDefPathData {
            data: AnonAssocTy(
                "method",
            ),
            disambiguator: 0,
        },
    ],
    krate: crate0,
} and DefPath {
    data: [
        DisambiguatedDefPathData {
            data: TypeNs(
                "Bar",
            ),
            disambiguator: 0,
        },
        DisambiguatedDefPathData {
            data: AnonAssocTy(
                "method",
            ),
            disambiguator: 0,
        },
    ],
    krate: crate0,
}. Compilation cannot continue.
stack backtrace:
   0:     0x762dc5163e43 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hc8e098b1215e964e
   1:     0x762dc5805c07 - core::fmt::write::h583ed6c83f41a855
   2:     0x762dc6870c51 - std::io::Write::write_fmt::h8f81fb06e9e8fee1
   3:     0x762dc5163ca2 - std::sys::backtrace::BacktraceLock::print::hecc1a51ebe0490cf
   4:     0x762dc516789a - std::panicking::default_hook::{{closure}}::hf1f4c4a76c9c89ad
   5:     0x762dc516741f - std::panicking::default_hook::h7712de3badaf8d92
   6:     0x762dc4196713 - std[2ecd24cfd14e710f]::panicking::update_hook::<alloc[e7a013d2a582f25b]::boxed::Box<rustc_driver_impl[fe7810e6b574cb6f]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x762dc5168113 - std::panicking::rust_panic_with_hook::ha5dc533cf5e3a0f0
   8:     0x762dc5167e0a - std::panicking::begin_panic_handler::{{closure}}::hd42e1b8311c9abcd
   9:     0x762dc5164319 - std::sys::backtrace::__rust_end_short_backtrace::h50dffba308434e81
  10:     0x762dc5167acd - __rustc[9792d8baf3412558]::rust_begin_unwind
  11:     0x762dc1a865a0 - core::panicking::panic_fmt::h1084ef89c29b9bac
  12:     0x762dc5f28218 - <rustc_middle[e2e735cb73dc82a4]::ty::context::TyCtxt>::create_def
  13:     0x762dc5f24540 - <rustc_middle[e2e735cb73dc82a4]::query::plumbing::TyCtxtAt>::create_def
  14:     0x762dc50e64c6 - rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_type_for_impl_trait_in_trait
  15:     0x762dc4c48d67 - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::associated_type_for_impl_trait_in_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 4usize]>>
  16:     0x762dc6800e87 - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_data_structures[ad9c7fd2490c2e66]::vec_cache::VecCache<rustc_span[8bbfce921ca97f76]::def_id::CrateNum, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 4usize]>, rustc_query_system[3aace006589e2dcc]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  17:     0x762dc4c582b0 - rustc_query_impl[c45186fe25608a11]::query_impl::associated_type_for_impl_trait_in_trait::get_query_non_incr::__rust_end_short_backtrace
  18:     0x762dc50e6074 - rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_types_for_impl_traits_in_associated_fn::{closure#0}
  19:     0x762dc60f79b6 - rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_types_for_impl_traits_in_associated_fn
  20:     0x762dc60f716c - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 16usize]>>
  21:     0x762dc60f711b - <rustc_query_impl[c45186fe25608a11]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2} as core[55677b73b6e313f4]::ops::function::FnOnce<(rustc_middle[e2e735cb73dc82a4]::ty::context::TyCtxt, rustc_span[8bbfce921ca97f76]::def_id::DefId)>>::call_once
  22:     0x762dc59d4392 - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_query_system[3aace006589e2dcc]::query::caches::DefIdCache<rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  23:     0x762dc59d3b65 - rustc_query_impl[c45186fe25608a11]::query_impl::associated_types_for_impl_traits_in_associated_fn::get_query_non_incr::__rust_end_short_backtrace
  24:     0x762dc67e651e - <core[55677b73b6e313f4]::iter::adapters::GenericShunt<core[55677b73b6e313f4]::iter::adapters::map::Map<core[55677b73b6e313f4]::iter::adapters::chain::Chain<core[55677b73b6e313f4]::iter::adapters::map::Map<core[55677b73b6e313f4]::slice::iter::Iter<rustc_hir[278d1db56afd1710]::hir::TraitItemRef>, rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#0}>, core[55677b73b6e313f4]::iter::adapters::copied::Copied<core[55677b73b6e313f4]::iter::adapters::flatten::FlatMap<core[55677b73b6e313f4]::iter::adapters::filter::Filter<core[55677b73b6e313f4]::slice::iter::Iter<rustc_hir[278d1db56afd1710]::hir::TraitItemRef>, rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#1}>, &[rustc_span[8bbfce921ca97f76]::def_id::DefId], rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#2}>>>, core[55677b73b6e313f4]::result::Result<rustc_span[8bbfce921ca97f76]::def_id::DefId, !>::Ok>, core[55677b73b6e313f4]::result::Result<core[55677b73b6e313f4]::convert::Infallible, !>> as core[55677b73b6e313f4]::iter::traits::iterator::Iterator>::next
  25:     0x762dc67e6190 - rustc_arena[716ee9466ebd5572]::outline::<<rustc_arena[716ee9466ebd5572]::DroplessArena>::alloc_from_iter<rustc_span[8bbfce921ca97f76]::def_id::DefId, core[55677b73b6e313f4]::iter::adapters::chain::Chain<core[55677b73b6e313f4]::iter::adapters::map::Map<core[55677b73b6e313f4]::slice::iter::Iter<rustc_hir[278d1db56afd1710]::hir::TraitItemRef>, rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#0}>, core[55677b73b6e313f4]::iter::adapters::copied::Copied<core[55677b73b6e313f4]::iter::adapters::flatten::FlatMap<core[55677b73b6e313f4]::iter::adapters::filter::Filter<core[55677b73b6e313f4]::slice::iter::Iter<rustc_hir[278d1db56afd1710]::hir::TraitItemRef>, rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#1}>, &[rustc_span[8bbfce921ca97f76]::def_id::DefId], rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids::{closure#2}>>>>::{closure#0}, &mut [rustc_span[8bbfce921ca97f76]::def_id::DefId]>
  26:     0x762dc6da07c8 - rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_item_def_ids.warm
  27:     0x762dc59d2de9 - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::associated_item_def_ids::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 16usize]>>
  28:     0x762dc59d2da9 - <rustc_query_impl[c45186fe25608a11]::query_impl::associated_item_def_ids::dynamic_query::{closure#2} as core[55677b73b6e313f4]::ops::function::FnOnce<(rustc_middle[e2e735cb73dc82a4]::ty::context::TyCtxt, rustc_span[8bbfce921ca97f76]::def_id::DefId)>>::call_once
  29:     0x762dc59d4392 - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_query_system[3aace006589e2dcc]::query::caches::DefIdCache<rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  30:     0x762dc59d3df5 - rustc_query_impl[c45186fe25608a11]::query_impl::associated_item_def_ids::get_query_non_incr::__rust_end_short_backtrace
  31:     0x762dc5a04e9c - rustc_ty_utils[28f493a60bf9b3f4]::assoc::associated_items
  32:     0x762dc5a04bf2 - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::associated_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 8usize]>>
  33:     0x762dc5c3beff - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_query_system[3aace006589e2dcc]::query::caches::DefIdCache<rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  34:     0x762dc5c3b180 - rustc_query_impl[c45186fe25608a11]::query_impl::associated_items::get_query_non_incr::__rust_end_short_backtrace
  35:     0x762dc606a177 - <rustc_hir_analysis[bcdf7bec670f0d1f]::collect::CollectItemTypesVisitor as rustc_hir[278d1db56afd1710]::intravisit::Visitor>::visit_item
  36:     0x762dc605f7b7 - rustc_hir_analysis[bcdf7bec670f0d1f]::check::wfcheck::check_well_formed
  37:     0x762dc605f5cb - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 1usize]>>
  38:     0x762dc605ee71 - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_data_structures[ad9c7fd2490c2e66]::vec_cache::VecCache<rustc_span[8bbfce921ca97f76]::def_id::LocalDefId, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[3aace006589e2dcc]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  39:     0x762dc605e966 - rustc_query_impl[c45186fe25608a11]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  40:     0x762dc605bee5 - rustc_hir_analysis[bcdf7bec670f0d1f]::check::wfcheck::check_mod_type_wf
  41:     0x762dc605bcdf - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 1usize]>>
  42:     0x762dc67f8484 - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_query_system[3aace006589e2dcc]::query::caches::DefaultCache<rustc_span[8bbfce921ca97f76]::def_id::LocalModDefId, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  43:     0x762dc67f8211 - rustc_query_impl[c45186fe25608a11]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  44:     0x762dc5a8f532 - rustc_hir_analysis[bcdf7bec670f0d1f]::check_crate
  45:     0x762dc5ccf937 - rustc_interface[38b8f1283a6cda7d]::passes::run_required_analyses
  46:     0x762dc67f949e - rustc_interface[38b8f1283a6cda7d]::passes::analysis
  47:     0x762dc67f9475 - rustc_query_impl[c45186fe25608a11]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c45186fe25608a11]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 0usize]>>
  48:     0x762dc674c3ba - rustc_query_system[3aace006589e2dcc]::query::plumbing::try_execute_query::<rustc_query_impl[c45186fe25608a11]::DynamicConfig<rustc_query_system[3aace006589e2dcc]::query::caches::SingleCache<rustc_middle[e2e735cb73dc82a4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c45186fe25608a11]::plumbing::QueryCtxt, false>
  49:     0x762dc674c08f - rustc_query_impl[c45186fe25608a11]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x762dc69bdfc7 - rustc_interface[38b8f1283a6cda7d]::passes::create_and_enter_global_ctxt::<core[55677b73b6e313f4]::option::Option<rustc_interface[38b8f1283a6cda7d]::queries::Linker>, rustc_driver_impl[fe7810e6b574cb6f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  51:     0x762dc68b81e6 - rustc_interface[38b8f1283a6cda7d]::interface::run_compiler::<(), rustc_driver_impl[fe7810e6b574cb6f]::run_compiler::{closure#0}>::{closure#1}
  52:     0x762dc686a83e - std[2ecd24cfd14e710f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[38b8f1283a6cda7d]::util::run_in_thread_with_globals<rustc_interface[38b8f1283a6cda7d]::util::run_in_thread_pool_with_globals<rustc_interface[38b8f1283a6cda7d]::interface::run_compiler<(), rustc_driver_impl[fe7810e6b574cb6f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  53:     0x762dc686acb4 - <<std[2ecd24cfd14e710f]::thread::Builder>::spawn_unchecked_<rustc_interface[38b8f1283a6cda7d]::util::run_in_thread_with_globals<rustc_interface[38b8f1283a6cda7d]::util::run_in_thread_pool_with_globals<rustc_interface[38b8f1283a6cda7d]::interface::run_compiler<(), rustc_driver_impl[fe7810e6b574cb6f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[55677b73b6e313f4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x762dc686c0ab - std::sys::pal::unix::thread::Thread::new::thread_start::hdd6937c40f2a7b3a
  55:     0x762dc06a370a - <unknown>
  56:     0x762dc0727aac - <unknown>
  57:                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-05-08T11_30_15-646177.txt` to your bug report

query stack during panic:
<HANG>

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels May 8, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 8, 2025
@matthiaskrgr matthiaskrgr added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. and removed C-bug Category: This is a bug. labels May 8, 2025
@matthiaskrgr
Copy link
Member Author

cc @Zoxc

@matthiaskrgr matthiaskrgr added the C-bug Category: This is a bug. label May 8, 2025
@cyrgani
Copy link
Contributor

cyrgani commented May 8, 2025

trait Bar {
    fn method() -> impl Sized;
    fn method() -> impl Sized;
}

fn main() {}

@rustbot label S-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label May 8, 2025
@moxian
Copy link
Contributor

moxian commented May 8, 2025

(bisects to #140453)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants