Repository: rust
Issue: ICE: `item_name: no name for DefPath`
Labels: I-ICE,T-compiler,C-bug,S-bug-has-test

<!--
[31mICE[0m: Rustc ./a.rs '' 'error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1594:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: ValueNs("a"), disambiguator: 0 }, DisambiguatedDefPathData { data: TypeNs(""), disambiguator: 0 }], krate: crate0 }', 'error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1594:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: ValueNs("a"), disambiguator: 0 }, DisambiguatedDefPathData { data: TypeNs(""), disambiguator: 0 }], krate: crate0 }'
File: /tmp/im2/a.rs
-->

snippet:
````rust
fn a(
    _: impl Iterator<
        Item = [(); {
                   match *todo!() { ! };
               }],
    >,
) {
}

````

Version information
````
rustc 1.85.0-nightly (481b5fadd 2024-11-24)
binary: rustc
commit-hash: 481b5fadd7994d0f04e9a6fe9ded3f22d6753825
commit-date: 2024-11-24
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.4

````

Possibly related line of code:
https://github.com/rust-lang/rust/blob/481b5fadd7994d0f04e9a6fe9ded3f22d6753825/compiler/rustc_middle/src/ty/mod.rs#L1588-L1600

Command:
`/home/matthias/.rustup/toolchains/master/bin/rustc `

<details><summary><strong>Program output</strong></summary>
<p>

```
error[E0658]: `!` patterns are experimental
 --> /tmp/icemaker_global_tempdir.RFI67OtIoUCV/rustc_testrunner_tmpdir_reporting.BmpfyXLeFAgh/mvce.rs:4:37
  |
4 |                    match *todo!() { ! };
  |                                     ^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = help: add `#![feature(never_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-24; consider upgrading it if it is out of date

error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1594:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: ValueNs("a"), disambiguator: 0 }, DisambiguatedDefPathData { data: TypeNs(""), disambiguator: 0 }], krate: crate0 }

thread 'rustc' panicked at compiler/rustc_middle/src/ty/mod.rs:1594:13:
Box<dyn Any>
stack backtrace:
   0:     0x7fada44bf8fa - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h99e2445636bcb92d
   1:     0x7fada4c24d7c - core::fmt::write::h812019335d70dce0
   2:     0x7fada6014b11 - std::io::Write::write_fmt::hcf100a634041ee1b
   3:     0x7fada44bf752 - std::sys::backtrace::BacktraceLock::print::hcac021922af4bfb2
   4:     0x7fada44c1c2a - std::panicking::default_hook::{{closure}}::h38cfa96ac70267dc
   5:     0x7fada44c1a90 - std::panicking::default_hook::hb27c01f91a1d7781
   6:     0x7fada35392a5 - std[1f3ac3280189331a]::panicking::update_hook::<alloc[4c85ded2b12904e4]::boxed::Box<rustc_driver_impl[23521148f3a5f4e2]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7fada44c2308 - std::panicking::rust_panic_with_hook::ha0a555d8ce7b1086
   8:     0x7fada3573db1 - std[1f3ac3280189331a]::panicking::begin_panic::<rustc_errors[ccc3cc1d084bad89]::ExplicitBug>::{closure#0}
   9:     0x7fada3566d56 - std[1f3ac3280189331a]::sys::backtrace::__rust_end_short_backtrace::<std[1f3ac3280189331a]::panicking::begin_panic<rustc_errors[ccc3cc1d084bad89]::ExplicitBug>::{closure#0}, !>
  10:     0x7fada3562329 - std[1f3ac3280189331a]::panicking::begin_panic::<rustc_errors[ccc3cc1d084bad89]::ExplicitBug>
  11:     0x7fada357dce1 - <rustc_errors[ccc3cc1d084bad89]::diagnostic::BugAbort as rustc_errors[ccc3cc1d084bad89]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7fada3bf4f03 - rustc_middle[b432c06521885074]::util::bug::opt_span_bug_fmt::<rustc_span[a0cbfa4ee9ea560a]::span_encoding::Span>::{closure#0}
  13:     0x7fada3bdd18a - rustc_middle[b432c06521885074]::ty::context::tls::with_opt::<rustc_middle[b432c06521885074]::util::bug::opt_span_bug_fmt<rustc_span[a0cbfa4ee9ea560a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7fada3bdd01b - rustc_middle[b432c06521885074]::ty::context::tls::with_context_opt::<rustc_middle[b432c06521885074]::ty::context::tls::with_opt<rustc_middle[b432c06521885074]::util::bug::opt_span_bug_fmt<rustc_span[a0cbfa4ee9ea560a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7fada1d08050 - rustc_middle[b432c06521885074]::util::bug::bug_fmt
  16:     0x7fada501112f - <rustc_ast_lowering[79467ad6dbcc4c8f]::LoweringContext>::lower_ty_direct
  17:     0x7fada500b9d8 - <rustc_ast_lowering[79467ad6dbcc4c8f]::LoweringContext>::lower_fn_decl
  18:     0x7fada5ce742d - <rustc_ast_lowering[79467ad6dbcc4c8f]::LoweringContext>::lower_item_kind
  19:     0x7fada4fd1c3d - <rustc_ast_lowering[79467ad6dbcc4c8f]::item::ItemLowerer>::lower_node
  20:     0x7fada4fd0990 - rustc_ast_lowering[79467ad6dbcc4c8f]::lower_to_hir
  21:     0x7fada5bdebb8 - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b696f309ae195481]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7fada5bddb35 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::<rustc_query_impl[b696f309ae195481]::DynamicConfig<rustc_query_system[62b31e2f5f52cd09]::query::caches::SingleCache<rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b696f309ae195481]::plumbing::QueryCtxt, false>
  23:     0x7fada5bdd6dd - rustc_query_impl[b696f309ae195481]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7fada4e36bc2 - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b696f309ae195481]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7fada4e361b7 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::<rustc_query_impl[b696f309ae195481]::DynamicConfig<rustc_data_structures[6ee81a484f31d219]::vec_cache::VecCache<rustc_hir[8382c86485cd6313]::hir_id::OwnerId, rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[62b31e2f5f52cd09]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b696f309ae195481]::plumbing::QueryCtxt, false>
  26:     0x7fada4e35f0f - rustc_query_impl[b696f309ae195481]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7fada50f6843 - <rustc_middle[b432c06521885074]::hir::map::Map>::attrs
  28:     0x7fada5d86200 - rustc_passes[f810fb5d3a359db7]::entry::entry_fn
  29:     0x7fada5d86198 - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b696f309ae195481]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 12usize]>>
  30:     0x7fada5d86171 - <rustc_query_impl[b696f309ae195481]::query_impl::entry_fn::dynamic_query::{closure#2} as core[6532f1aa9b91b5ff]::ops::function::FnOnce<(rustc_middle[b432c06521885074]::ty::context::TyCtxt, ())>>::call_once
  31:     0x7fada5d85b09 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::<rustc_query_impl[b696f309ae195481]::DynamicConfig<rustc_query_system[62b31e2f5f52cd09]::query::caches::SingleCache<rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[b696f309ae195481]::plumbing::QueryCtxt, false>
  32:     0x7fada5d858a8 - rustc_query_impl[b696f309ae195481]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fada55a257f - rustc_interface[8ffc5b6c08143df7]::passes::run_required_analyses
  34:     0x7fada5596a9e - rustc_interface[8ffc5b6c08143df7]::passes::analysis
  35:     0x7fada5596a6f - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b696f309ae195481]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7fada5bdb3ee - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::<rustc_query_impl[b696f309ae195481]::DynamicConfig<rustc_query_system[62b31e2f5f52cd09]::query::caches::SingleCache<rustc_middle[b432c06521885074]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b696f309ae195481]::plumbing::QueryCtxt, false>
  37:     0x7fada5bdb0ce - rustc_query_impl[b696f309ae195481]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7fada5aeb9d8 - rustc_interface[8ffc5b6c08143df7]::interface::run_compiler::<core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>, rustc_driver_impl[23521148f3a5f4e2]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7fada5b66820 - std[1f3ac3280189331a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8ffc5b6c08143df7]::util::run_in_thread_with_globals<rustc_interface[8ffc5b6c08143df7]::util::run_in_thread_pool_with_globals<rustc_interface[8ffc5b6c08143df7]::interface::run_compiler<core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>, rustc_driver_impl[23521148f3a5f4e2]::run_compiler::{closure#0}>::{closure#1}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>::{closure#0}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>
  40:     0x7fada5b6653d - <<std[1f3ac3280189331a]::thread::Builder>::spawn_unchecked_<rustc_interface[8ffc5b6c08143df7]::util::run_in_thread_with_globals<rustc_interface[8ffc5b6c08143df7]::util::run_in_thread_pool_with_globals<rustc_interface[8ffc5b6c08143df7]::interface::run_compiler<core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>, rustc_driver_impl[23521148f3a5f4e2]::run_compiler::{closure#0}>::{closure#1}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>::{closure#0}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6532f1aa9b91b5ff]::result::Result<(), rustc_span[a0cbfa4ee9ea560a]::ErrorGuaranteed>>::{closure#1} as core[6532f1aa9b91b5ff]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7fada5b65cf9 - std::sys::pal::unix::thread::Thread::new::thread_start::h8f9ff78050bb9448
  42:     0x7fada735139d - <unknown>
  43:     0x7fada73d649c - <unknown>
  44:                0x0 - <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: rustc 1.85.0-nightly (481b5fadd 2024-11-24) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [hir_attrs] getting HIR owner attributes in ``
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.

```

</p>
</details>

<!--
query stack:
#0 [hir_crate] getting the crate HIR
#1 [hir_attrs] getting HIR owner attributes in ``

-->