Skip to content
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

ICE: item_name: no name for DefPath #133426

Closed
matthiaskrgr opened this issue Nov 24, 2024 · 1 comment
Closed

ICE: item_name: no name for DefPath #133426

matthiaskrgr opened this issue Nov 24, 2024 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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:

/// This method will ICE if the corresponding item does not have a name. In these cases, use
/// [`opt_item_name`] instead.
///
/// [`opt_item_name`]: Self::opt_item_name
pub fn item_name(self, id: DefId) -> Symbol {
self.opt_item_name(id).unwrap_or_else(|| {
bug!("item_name: no name for {:?}", self.def_path(id));
})
}
/// Look up the name and span of a definition.
///
/// See [`item_name`][Self::item_name] for more information.

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 <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`.

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. 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. labels Nov 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 24, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Nov 24, 2024

Slightly shorter:

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

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 26, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Dec 14, 2024
nnethercote added a commit to nnethercote/rust that referenced this issue Mar 4, 2025
Currently it relies on special treatment of `kw::Empty`, which is really
easy to get wrong. This commit makes the special case clearer in the
type system by using `Option`. It's a bit clumsy, but the synthetic name
handling itself is a bit clumsy; better to make it explicit than sneak
it in.

Fixes rust-lang#133426.
nnethercote added a commit to nnethercote/rust that referenced this issue Mar 4, 2025
Currently it relies on special treatment of `kw::Empty`, which is really
easy to get wrong. This commit makes the special case clearer in the
type system by using `Option`. It's a bit clumsy, but the synthetic name
handling itself is a bit clumsy; better to make it explicit than sneak
it in.

Fixes rust-lang#133426.
@bors bors closed this as completed in af92a33 Mar 7, 2025
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-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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