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: no name for HirId #138723

Closed
matthiaskrgr opened this issue Mar 19, 2025 · 3 comments · Fixed by #138724
Closed

ICE: no name for HirId #138723

matthiaskrgr opened this issue Mar 19, 2025 · 3 comments · Fixed by #138724
Assignees
Labels
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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

pub mod __private {
    #[doc(alias = "foobar")]
    pub use core::option::Option::{self, None, Some};
}

original:

#![crate_type = "lib"]

extern crate core;

pub mod __private {
    #[doc(alias = "foobar")]
    pub use core::option::Option::{self, None, Some};
}

Version information

rustc 1.87.0-nightly (1aeb99d24 2025-03-19)
binary: rustc
commit-hash: 1aeb99d248e1b0069110cb03c6f1dcc7b36fd7f3
commit-date: 2025-03-19
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

#[inline]
pub fn hir_opt_name(self, id: HirId) -> Option<Symbol> {
self.hir_opt_ident(id).map(|ident| ident.name)
}
pub fn hir_name(self, id: HirId) -> Symbol {
self.hir_opt_name(id).unwrap_or_else(|| bug!("no name for {}", self.hir_id_to_string(id)))
}
/// Given a node ID, gets a list of attributes associated with the AST
/// corresponding to the node-ID.
pub fn hir_attrs(self, id: HirId) -> &'tcx [Attribute] {
self.hir_attr_map(id.owner).get(id.local_id)

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

Program output

error[E0433]: failed to resolve: you might be missing crate `core`
 --> /tmp/icemaker_global_tempdir.UL96RZIpe8sw/rustc_testrunner_tmpdir_reporting.0cJPJ5tcWZoC/mvce.rs:3:13
  |
3 |     pub use core::option::Option::{self, None, Some};
  |             ^^^^
  |             |
  |             you might be missing crate `core`
  |             help: try using `std` instead of `core`: `std`

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.UL96RZIpe8sw/rustc_testrunner_tmpdir_reporting.0cJPJ5tcWZoC/mvce.rs:4:2
  |
4 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.UL96RZIpe8sw/rustc_testrunner_tmpdir_reporting.0cJPJ5tcWZoC/mvce.rs`

error: internal compiler error: compiler/rustc_middle/src/hir/map.rs:874:49: no name for HirId(DefId(0:4 ~ mvce[4924]::__private::{use#0}).0) (use __private::{use#0})


thread 'rustc' panicked at compiler/rustc_middle/src/hir/map.rs:874:49:
Box<dyn Any>
stack backtrace:
   0:     0x79e046a30083 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hcd66661bdf57146f
   1:     0x79e047205a58 - core::fmt::write::hd9b56e7625c39f19
   2:     0x79e0485ebf11 - std::io::Write::write_fmt::h37840dd5ce003363
   3:     0x79e046a2fee2 - std::sys::backtrace::BacktraceLock::print::hef64143f1cbca931
   4:     0x79e046a3279a - std::panicking::default_hook::{{closure}}::hd6bf8dbda2b344c4
   5:     0x79e046a3231f - std::panicking::default_hook::h026ddab426b21d5f
   6:     0x79e045a9c4f0 - std[9f03342d7f195677]::panicking::update_hook::<alloc[3c4d20c77824b8cf]::boxed::Box<rustc_driver_impl[89acc905075c90ca]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x79e046a33013 - std::panicking::rust_panic_with_hook::h9541e53aee5dc965
   8:     0x79e045ad9c61 - std[9f03342d7f195677]::panicking::begin_panic::<rustc_errors[23ae233dd17a361]::ExplicitBug>::{closure#0}
   9:     0x79e045acde26 - std[9f03342d7f195677]::sys::backtrace::__rust_end_short_backtrace::<std[9f03342d7f195677]::panicking::begin_panic<rustc_errors[23ae233dd17a361]::ExplicitBug>::{closure#0}, !>
  10:     0x79e045aca99b - std[9f03342d7f195677]::panicking::begin_panic::<rustc_errors[23ae233dd17a361]::ExplicitBug>
  11:     0x79e045ae34f1 - <rustc_errors[23ae233dd17a361]::diagnostic::BugAbort as rustc_errors[23ae233dd17a361]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x79e04611da9a - rustc_middle[e64f972a0eed9fe9]::util::bug::opt_span_bug_fmt::<rustc_span[66f0cb4a2884adb1]::span_encoding::Span>::{closure#0}
  13:     0x79e0460f93da - rustc_middle[e64f972a0eed9fe9]::ty::context::tls::with_opt::<rustc_middle[e64f972a0eed9fe9]::util::bug::opt_span_bug_fmt<rustc_span[66f0cb4a2884adb1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x79e0460f924b - rustc_middle[e64f972a0eed9fe9]::ty::context::tls::with_context_opt::<rustc_middle[e64f972a0eed9fe9]::ty::context::tls::with_opt<rustc_middle[e64f972a0eed9fe9]::util::bug::opt_span_bug_fmt<rustc_span[66f0cb4a2884adb1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x79e0440eafb0 - rustc_middle[e64f972a0eed9fe9]::util::bug::bug_fmt
  16:     0x79e047c6ad08 - <rustc_middle[e64f972a0eed9fe9]::ty::context::TyCtxt>::hir_name
  17:     0x79e0463d5618 - <rustc_passes[768cd036decd41ad]::check_attr::CheckAttrVisitor>::check_doc_alias_value
  18:     0x79e047662c67 - <rustc_passes[768cd036decd41ad]::check_attr::CheckAttrVisitor>::check_attributes
  19:     0x79e04765a749 - <rustc_passes[768cd036decd41ad]::check_attr::CheckAttrVisitor as rustc_hir[21ecbff285be6187]::intravisit::Visitor>::visit_item
  20:     0x79e047659dc9 - rustc_passes[768cd036decd41ad]::check_attr::check_mod_attrs
  21:     0x79e047659c67 - rustc_query_impl[111d42b6c7617eec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[111d42b6c7617eec]::query_impl::check_mod_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e64f972a0eed9fe9]::query::erase::Erased<[u8; 0usize]>>
  22:     0x79e0480582db - rustc_query_system[45248ca72eea94cf]::query::plumbing::try_execute_query::<rustc_query_impl[111d42b6c7617eec]::DynamicConfig<rustc_query_system[45248ca72eea94cf]::query::caches::DefaultCache<rustc_span[66f0cb4a2884adb1]::def_id::LocalModDefId, rustc_middle[e64f972a0eed9fe9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[111d42b6c7617eec]::plumbing::QueryCtxt, false>
  23:     0x79e048057ffe - rustc_query_impl[111d42b6c7617eec]::query_impl::check_mod_attrs::get_query_non_incr::__rust_end_short_backtrace
  24:     0x79e048057bf8 - <rustc_middle[e64f972a0eed9fe9]::ty::context::TyCtxt>::par_hir_for_each_module::<rustc_interface[195e0d6332ccbe00]::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}::{closure#0}>::{closure#0}
  25:     0x79e0475cfcdb - rustc_interface[195e0d6332ccbe00]::passes::run_required_analyses
  26:     0x79e04805a21e - rustc_interface[195e0d6332ccbe00]::passes::analysis
  27:     0x79e04805a1ed - rustc_query_impl[111d42b6c7617eec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[111d42b6c7617eec]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e64f972a0eed9fe9]::query::erase::Erased<[u8; 0usize]>>
  28:     0x79e048308847 - rustc_query_system[45248ca72eea94cf]::query::plumbing::try_execute_query::<rustc_query_impl[111d42b6c7617eec]::DynamicConfig<rustc_query_system[45248ca72eea94cf]::query::caches::SingleCache<rustc_middle[e64f972a0eed9fe9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[111d42b6c7617eec]::plumbing::QueryCtxt, false>
  29:     0x79e048308542 - rustc_query_impl[111d42b6c7617eec]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  30:     0x79e0484a7e3d - rustc_interface[195e0d6332ccbe00]::passes::create_and_enter_global_ctxt::<core[c8873f6475d1fb5c]::option::Option<rustc_interface[195e0d6332ccbe00]::queries::Linker>, rustc_driver_impl[89acc905075c90ca]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  31:     0x79e04834756f - rustc_interface[195e0d6332ccbe00]::interface::run_compiler::<(), rustc_driver_impl[89acc905075c90ca]::run_compiler::{closure#0}>::{closure#1}
  32:     0x79e0481b5348 - std[9f03342d7f195677]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[195e0d6332ccbe00]::util::run_in_thread_with_globals<rustc_interface[195e0d6332ccbe00]::util::run_in_thread_pool_with_globals<rustc_interface[195e0d6332ccbe00]::interface::run_compiler<(), rustc_driver_impl[89acc905075c90ca]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  33:     0x79e0481b5c34 - <<std[9f03342d7f195677]::thread::Builder>::spawn_unchecked_<rustc_interface[195e0d6332ccbe00]::util::run_in_thread_with_globals<rustc_interface[195e0d6332ccbe00]::util::run_in_thread_pool_with_globals<rustc_interface[195e0d6332ccbe00]::interface::run_compiler<(), rustc_driver_impl[89acc905075c90ca]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c8873f6475d1fb5c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x79e0481b7037 - std::sys::pal::unix::thread::Thread::new::thread_start::ha289eae81ff6032e
  35:     0x79e0420a370a - <unknown>
  36:     0x79e042127aac - <unknown>
  37:                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.87.0-nightly (1aeb99d24 2025-03-19) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_attrs] checking attributes in module `__private`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0433, E0601.
For more information about an error, try `rustc --explain E0433`.

@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 Mar 19, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2025
@matthiaskrgr
Copy link
Member Author

mvce I guess

mod a {
#[doc(alias = "a")]
  use {};
}

pub fn main() {}

@matthiaskrgr
Copy link
Member Author

regressed in #138384

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2025
@lqd
Copy link
Member

lqd commented Mar 19, 2025

cc @nnethercote on that bisection

@fmease fmease self-assigned this Mar 19, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 20, 2025
…nnethercote

Check attrs: Don't try to retrieve the name of list stems

Fixes rust-lang#138723.

r? nnethercote or compiler
@bors bors closed this as completed in 1135a63 Mar 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 21, 2025
Rollup merge of rust-lang#138724 - fmease:list-stems-bear-no-name, r=nnethercote

Check attrs: Don't try to retrieve the name of list stems

Fixes rust-lang#138723.

r? nnethercote or compiler
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants