rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.98k stars 12.79k forks source link

ICE: `item_name: no name for DefPath` #133426

Open matthiaskrgr opened 4 days ago

matthiaskrgr commented 4 days ago

snippet:

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

Program output

``` 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 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 stack backtrace: 0: 0x7fada44bf8fa - ::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::>::{closure#0} 7: 0x7fada44c2308 - std::panicking::rust_panic_with_hook::ha0a555d8ce7b1086 8: 0x7fada3573db1 - std[1f3ac3280189331a]::panicking::begin_panic::::{closure#0} 9: 0x7fada3566d56 - std[1f3ac3280189331a]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 10: 0x7fada3562329 - std[1f3ac3280189331a]::panicking::begin_panic:: 11: 0x7fada357dce1 - ::emit_producing_guarantee 12: 0x7fada3bf4f03 - rustc_middle[b432c06521885074]::util::bug::opt_span_bug_fmt::::{closure#0} 13: 0x7fada3bdd18a - rustc_middle[b432c06521885074]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 14: 0x7fada3bdd01b - rustc_middle[b432c06521885074]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 15: 0x7fada1d08050 - rustc_middle[b432c06521885074]::util::bug::bug_fmt 16: 0x7fada501112f - ::lower_ty_direct 17: 0x7fada500b9d8 - ::lower_fn_decl 18: 0x7fada5ce742d - ::lower_item_kind 19: 0x7fada4fd1c3d - ::lower_node 20: 0x7fada4fd0990 - rustc_ast_lowering[79467ad6dbcc4c8f]::lower_to_hir 21: 0x7fada5bdebb8 - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::> 22: 0x7fada5bddb35 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::>, 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::> 25: 0x7fada4e361b7 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::, 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 - ::attrs 28: 0x7fada5d86200 - rustc_passes[f810fb5d3a359db7]::entry::entry_fn 29: 0x7fada5d86198 - rustc_query_impl[b696f309ae195481]::plumbing::__rust_begin_short_backtrace::> 30: 0x7fada5d86171 - >::call_once 31: 0x7fada5d85b09 - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::>, 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::> 36: 0x7fada5bdb3ee - rustc_query_system[62b31e2f5f52cd09]::query::plumbing::try_execute_query::>, 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::, rustc_driver_impl[23521148f3a5f4e2]::run_compiler::{closure#0}>::{closure#1} 39: 0x7fada5b66820 - std[1f3ac3280189331a]::sys::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 - 43: 0x7fada73d649c - 44: 0x0 - 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`. ```

cyrgani commented 4 days ago

Slightly shorter:

fn a(_: impl Iterator<Item = { match 0 { ! } }>) {}