Skip to content

ICE: No HirId for DefId #137708

@matthiaskrgr

Description

@matthiaskrgr

snippet:

fn a() { match 0 { ! > || { use std::ops::Add; b.add} } }

Version information

rustc 1.87.0-nightly (96cfc7558 2025-02-27) binary: rustc commit-hash: 96cfc75584359ae7ad11cc45968059f29e7b44b7 commit-date: 2025-02-27 host: x86_64-unknown-linux-gnu release: 1.87.0-nightly LLVM version: 20.1.0 

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

Program output

error: expected one of `=>`, `if`, or `|`, found `>` --> /tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs:2:17 | 2 | match 0 { ! > || { | ^ | | | expected one of `=>`, `if`, or `|` | help: use a fat arrow to start a match arm: `=>` error[E0425]: cannot find value `b` in this scope --> /tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs:4:3 | 4 | b.add} | ^ not found in this scope error[E0658]: `!` patterns are experimental --> /tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs:2:15 | 2 | match 0 { ! > || { | ^ | = 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 2025-02-27; consider upgrading it if it is out of date error: a never pattern is always unreachable --> /tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs:2:19 | 2 | match 0 { ! > || { | ___________________^ 3 | | use std::ops::Add; 4 | | b.add} | | ^ | | | | |___________this will never be executed | help: remove this expression error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs:6:2 | 6 | } | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.4NhLKLoBWejZ/rustc_testrunner_tmpdir_reporting.egnyO6AZ3a4q/mvce.rs` error: internal compiler error: /rustc/96cfc75584359ae7ad11cc45968059f29e7b44b7/compiler/rustc_middle/src/hir/mod.rs:187:32: No HirId for DefId(0:4 ~ mvce[3f34]::a::{closure#0}) thread 'rustc' panicked at /rustc/96cfc75584359ae7ad11cc45968059f29e7b44b7/compiler/rustc_middle/src/hir/mod.rs:187:32: Box<dyn Any> stack backtrace: 0: 0x7e7c67dc4244 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf225decb46b08272 1: 0x7e7c6861676c - core::fmt::write::h1fb2a0590e0ff7db 2: 0x7e7c696924d1 - std::io::Write::write_fmt::h322e0d6ffea70726 3: 0x7e7c67dc40a2 - std::sys::backtrace::BacktraceLock::print::h76c95e4844aa5f5a 4: 0x7e7c67dc68de - std::panicking::default_hook::{{closure}}::ha1d70e13071d5b09 5: 0x7e7c67dc64b4 - std::panicking::default_hook::hc8812898fec1d96d 6: 0x7e7c66f23807 - std[7cbd2cc368ec1689]::panicking::update_hook::<alloc[c5a67f14fd3248b2]::boxed::Box<rustc_driver_impl[8a6303e5b48c754]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x7e7c67dc7153 - std::panicking::rust_panic_with_hook::h24b4bdc54f868d91 8: 0x7e7c66f604b1 - std[7cbd2cc368ec1689]::panicking::begin_panic::<rustc_errors[2b552e74fca072ca]::ExplicitBug>::{closure#0} 9: 0x7e7c66f548c6 - std[7cbd2cc368ec1689]::sys::backtrace::__rust_end_short_backtrace::<std[7cbd2cc368ec1689]::panicking::begin_panic<rustc_errors[2b552e74fca072ca]::ExplicitBug>::{closure#0}, !> 10: 0x7e7c66f51249 - std[7cbd2cc368ec1689]::panicking::begin_panic::<rustc_errors[2b552e74fca072ca]::ExplicitBug> 11: 0x7e7c66f69ea1 - <rustc_errors[2b552e74fca072ca]::diagnostic::BugAbort as rustc_errors[2b552e74fca072ca]::diagnostic::EmissionGuarantee>::emit_producing_guarantee 12: 0x7e7c6753c2d6 - rustc_middle[5f05a97551d28ad7]::util::bug::opt_span_bug_fmt::<rustc_span[4f93a263ebfd8629]::span_encoding::Span>::{closure#0} 13: 0x7e7c67523b4a - rustc_middle[5f05a97551d28ad7]::ty::context::tls::with_opt::<rustc_middle[5f05a97551d28ad7]::util::bug::opt_span_bug_fmt<rustc_span[4f93a263ebfd8629]::span_encoding::Span>::{closure#0}, !>::{closure#0} 14: 0x7e7c675239bb - rustc_middle[5f05a97551d28ad7]::ty::context::tls::with_context_opt::<rustc_middle[5f05a97551d28ad7]::ty::context::tls::with_opt<rustc_middle[5f05a97551d28ad7]::util::bug::opt_span_bug_fmt<rustc_span[4f93a263ebfd8629]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !> 15: 0x7e7c65ab9250 - rustc_middle[5f05a97551d28ad7]::util::bug::bug_fmt 16: 0x7e7c689f493d - rustc_query_impl[cc6351b15889f3aa]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cc6351b15889f3aa]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 8usize]>> 17: 0x7e7c689f41f0 - rustc_query_system[fb6ca0b3ba597712]::query::plumbing::try_execute_query::<rustc_query_impl[cc6351b15889f3aa]::DynamicConfig<rustc_data_structures[49bf46f4cf4825f2]::vec_cache::VecCache<rustc_span[4f93a263ebfd8629]::def_id::LocalDefId, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[fb6ca0b3ba597712]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[cc6351b15889f3aa]::plumbing::QueryCtxt, false> 18: 0x7e7c689f3c8d - rustc_query_impl[cc6351b15889f3aa]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace 19: 0x7e7c68d4b7f4 - rustc_query_impl[cc6351b15889f3aa]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cc6351b15889f3aa]::query_impl::hir_owner_parent::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 8usize]>> 20: 0x7e7c68d4a839 - rustc_query_system[fb6ca0b3ba597712]::query::plumbing::try_execute_query::<rustc_query_impl[cc6351b15889f3aa]::DynamicConfig<rustc_data_structures[49bf46f4cf4825f2]::vec_cache::VecCache<rustc_hir[dd20287c0dd43567]::hir_id::OwnerId, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[fb6ca0b3ba597712]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[cc6351b15889f3aa]::plumbing::QueryCtxt, false> 21: 0x7e7c68d4a40c - rustc_query_impl[cc6351b15889f3aa]::query_impl::hir_owner_parent::get_query_non_incr::__rust_end_short_backtrace 22: 0x7e7c69146d09 - <rustc_middle[5f05a97551d28ad7]::lint::ShallowLintLevelMap>::lint_level_id_at_node 23: 0x7e7c691461d9 - <rustc_middle[5f05a97551d28ad7]::ty::context::TyCtxt>::lint_level_at_node 24: 0x7e7c68eee0c4 - rustc_hir_analysis[a3b89f1702df4c1]::check_unused::check_unused_traits 25: 0x7e7c68eedd51 - rustc_query_impl[cc6351b15889f3aa]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cc6351b15889f3aa]::query_impl::check_unused_traits::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 0usize]>> 26: 0x7e7c696e4a8b - rustc_query_system[fb6ca0b3ba597712]::query::plumbing::try_execute_query::<rustc_query_impl[cc6351b15889f3aa]::DynamicConfig<rustc_query_system[fb6ca0b3ba597712]::query::caches::SingleCache<rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[cc6351b15889f3aa]::plumbing::QueryCtxt, false> 27: 0x7e7c696e47fd - rustc_query_impl[cc6351b15889f3aa]::query_impl::check_unused_traits::get_query_non_incr::__rust_end_short_backtrace 28: 0x7e7c689f22b5 - rustc_hir_analysis[a3b89f1702df4c1]::check_crate 29: 0x7e7c689ec52a - rustc_interface[d2a053ff6259bd5e]::passes::run_required_analyses 30: 0x7e7c6968e47a - rustc_interface[d2a053ff6259bd5e]::passes::analysis 31: 0x7e7c6968e459 - rustc_query_impl[cc6351b15889f3aa]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cc6351b15889f3aa]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 0usize]>> 32: 0x7e7c696e4a8b - rustc_query_system[fb6ca0b3ba597712]::query::plumbing::try_execute_query::<rustc_query_impl[cc6351b15889f3aa]::DynamicConfig<rustc_query_system[fb6ca0b3ba597712]::query::caches::SingleCache<rustc_middle[5f05a97551d28ad7]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[cc6351b15889f3aa]::plumbing::QueryCtxt, false> 33: 0x7e7c696e4779 - rustc_query_impl[cc6351b15889f3aa]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 34: 0x7e7c69735f7c - rustc_interface[d2a053ff6259bd5e]::passes::create_and_enter_global_ctxt::<core[d5e017cae25c04c4]::option::Option<rustc_interface[d2a053ff6259bd5e]::queries::Linker>, rustc_driver_impl[8a6303e5b48c754]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 35: 0x7e7c69726ba0 - rustc_interface[d2a053ff6259bd5e]::interface::run_compiler::<(), rustc_driver_impl[8a6303e5b48c754]::run_compiler::{closure#0}>::{closure#1} 36: 0x7e7c6966bdc8 - std[7cbd2cc368ec1689]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d2a053ff6259bd5e]::util::run_in_thread_with_globals<rustc_interface[d2a053ff6259bd5e]::util::run_in_thread_pool_with_globals<rustc_interface[d2a053ff6259bd5e]::interface::run_compiler<(), rustc_driver_impl[8a6303e5b48c754]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 37: 0x7e7c6966c1f4 - <<std[7cbd2cc368ec1689]::thread::Builder>::spawn_unchecked_<rustc_interface[d2a053ff6259bd5e]::util::run_in_thread_with_globals<rustc_interface[d2a053ff6259bd5e]::util::run_in_thread_pool_with_globals<rustc_interface[d2a053ff6259bd5e]::interface::run_compiler<(), rustc_driver_impl[8a6303e5b48c754]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d5e017cae25c04c4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 38: 0x7e7c6966d6eb - std::sys::pal::unix::thread::Thread::new::thread_start::h09ac065530806028 39: 0x7e7c636a370a - <unknown> 40: 0x7e7c63727aac - <unknown> 41: 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 (96cfc7558 2025-02-27) running on x86_64-unknown-linux-gnu query stack during panic: #0 [local_def_id_to_hir_id] getting HIR ID of `a::{closure#0}` #1 [hir_owner_parent] getting HIR parent of `a::{closure#0}::{use#0}` #2 [check_unused_traits] checking unused trait imports in crate #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to 6 previous errors Some errors have detailed explanations: E0425, E0601, E0658. For more information about an error, try `rustc --explain E0425`. 

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-never_patterns`#![feature(never_patterns)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions