Skip to content

ICE: No parent for node HirId(...) #119271

Closed
@matthiaskrgr

Description

@matthiaskrgr

snippet:

fn no_arms_or_guards(&self, other: &B) {
    match None::<Void> {
        Some(!) if
        #[deny(unused_mut)]
        None => {}
    }
    match None::<Void> {}
}

Version information

rustc 1.77.0-nightly (2d7be7393 2023-12-23)
binary: rustc
commit-hash: 2d7be73931e0978c8758a672cc7258b417a7e999
commit-date: 2023-12-23
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

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

Program output

error[E0658]: attributes on expressions are experimental
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:4:9
  |
4 |         #[deny(unused_mut)]
  |         ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

error: `self` parameter is only allowed in associated functions
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:1:22
  |
1 | fn no_arms_or_guards(&self, other: &B) {
  |                      ^^^^^ not semantically valid as function parameter
  |
  = note: associated functions are those in `impl` or `trait` definitions

error[E0412]: cannot find type `B` in this scope
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:1:37
  |
1 | fn no_arms_or_guards(&self, other: &B) {
  |                                     ^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | fn no_arms_or_guards<B>(&self, other: &B) {
  |                     +++

error[E0412]: cannot find type `Void` in this scope
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:2:18
  |
2 |     match None::<Void> {
  |                  ^^^^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | fn no_arms_or_guards<Void>(&self, other: &B) {
  |                     ++++++

error[E0412]: cannot find type `Void` in this scope
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:7:18
  |
7 |     match None::<Void> {}
  |                  ^^^^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | fn no_arms_or_guards<Void>(&self, other: &B) {
  |                     ++++++

error[E0658]: `!` patterns are experimental
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:3:14
  |
3 |         Some(!) if
  |              ^
  |
  = 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

error: a never pattern is always unreachable
 --> /tmp/icemaker_global_tempdir.4TZJJniPKMoO/rustc_testrunner_tmpdir_reporting.NgjLTMYcJ13G/mvce.rs:5:17
  |
5 |         None => {}
  |                 ^^
  |                 |
  |                 this will never be executed
  |                 help: remove this expression

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

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:228:32: No parent for node HirId(DefId(0:3 ~ mvce[8437]::no_arms_or_guards).13) (unknown node)

thread 'rustc' panicked at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/compiler/rustc_errors/src/lib.rs:1056:30:
Box<dyn Any>
stack backtrace:
   0:     0x7f1ca338b6f6 - std::backtrace_rs::backtrace::libunwind::trace::h854d9901466ba2a6
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f1ca338b6f6 - std::backtrace_rs::backtrace::trace_unsynchronized::h2e5473e1358f3d7d
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1ca338b6f6 - std::sys_common::backtrace::_print_fmt::h17999543628ef5b9
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f1ca338b6f6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4a315f9d82cb167
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1ca33ddf40 - core::fmt::rt::Argument::fmt::h61d1362a4781e5b2
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/fmt/rt.rs:142:9
   5:     0x7f1ca33ddf40 - core::fmt::write::hdd3124965f70515e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f1ca337f53f - std::io::Write::write_fmt::hf681a4235a84103e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/io/mod.rs:1810:15
   7:     0x7f1ca338b4d4 - std::sys_common::backtrace::_print::hf875b2182006ee31
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1ca338b4d4 - std::sys_common::backtrace::print::h6091516d06acaa34
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1ca338e267 - std::panicking::default_hook::{{closure}}::h7008dc256987fa65
  10:     0x7f1ca338dfc9 - std::panicking::default_hook::he81ec00845e2991e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:292:9
  11:     0x7f1ca615adec - std[76579cbcf5e75e71]::panicking::update_hook::<alloc[b53221f29dc7d1be]::boxed::Box<rustc_driver_impl[5725e9f2ae9a40a2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f1ca338e9b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfccb34defa5e1891
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2029:9
  13:     0x7f1ca338e9b6 - std::panicking::rust_panic_with_hook::ha947ff64165fedb2
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:783:13
  14:     0x7f1ca6193a94 - std[76579cbcf5e75e71]::panicking::begin_panic::<rustc_errors[64d26b4b709225b4]::ExplicitBug>::{closure#0}
  15:     0x7f1ca61901d6 - std[76579cbcf5e75e71]::sys_common::backtrace::__rust_end_short_backtrace::<std[76579cbcf5e75e71]::panicking::begin_panic<rustc_errors[64d26b4b709225b4]::ExplicitBug>::{closure#0}, !>
  16:     0x7f1ca618fb86 - std[76579cbcf5e75e71]::panicking::begin_panic::<rustc_errors[64d26b4b709225b4]::ExplicitBug>
  17:     0x7f1ca619e991 - <rustc_errors[64d26b4b709225b4]::diagnostic_builder::BugAbort as rustc_errors[64d26b4b709225b4]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f1ca657152e - <rustc_errors[64d26b4b709225b4]::DiagCtxt>::bug::<alloc[b53221f29dc7d1be]::string::String>
  19:     0x7f1ca660ca7b - rustc_middle[3892716d31dc4121]::util::bug::opt_span_bug_fmt::<rustc_span[d159d62802098cb3]::span_encoding::Span>::{closure#0}
  20:     0x7f1ca65f5e1a - rustc_middle[3892716d31dc4121]::ty::context::tls::with_opt::<rustc_middle[3892716d31dc4121]::util::bug::opt_span_bug_fmt<rustc_span[d159d62802098cb3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f1ca65f5cb8 - rustc_middle[3892716d31dc4121]::ty::context::tls::with_context_opt::<rustc_middle[3892716d31dc4121]::ty::context::tls::with_opt<rustc_middle[3892716d31dc4121]::util::bug::opt_span_bug_fmt<rustc_span[d159d62802098cb3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f1ca45a05a0 - rustc_middle[3892716d31dc4121]::util::bug::bug_fmt
  23:     0x7f1ca77d87ee - <rustc_middle[3892716d31dc4121]::lint::ShallowLintLevelMap>::lint_level_id_at_node
  24:     0x7f1ca77d01e2 - <rustc_lint[2004c59de88667a6]::levels::LintLevelsBuilder<rustc_lint[2004c59de88667a6]::levels::LintLevelQueryMap>>::insert_spec
  25:     0x7f1ca77cd1c6 - <rustc_lint[2004c59de88667a6]::levels::LintLevelsBuilder<rustc_lint[2004c59de88667a6]::levels::LintLevelQueryMap>>::add_id
  26:     0x7f1ca77db5d5 - rustc_lint[2004c59de88667a6]::levels::shallow_lint_levels_on
  27:     0x7f1ca77db230 - rustc_query_impl[d4cc752ff0d73f28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4cc752ff0d73f28]::query_impl::shallow_lint_levels_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f1ca77d9ca7 - rustc_query_system[d117b86e449fcdf2]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc752ff0d73f28]::DynamicConfig<rustc_query_system[d117b86e449fcdf2]::query::caches::VecCache<rustc_hir[aece1b293382bb07]::hir_id::OwnerId, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d4cc752ff0d73f28]::plumbing::QueryCtxt, false>
  29:     0x7f1ca77d9890 - rustc_query_impl[d4cc752ff0d73f28]::query_impl::shallow_lint_levels_on::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f1ca77d5ce6 - <rustc_middle[3892716d31dc4121]::ty::context::TyCtxt>::lint_level_at_node
  31:     0x7f1ca7e9df38 - <rustc_hir_typeck[fd96d09303487d80]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f1ca7a4d41d - <rustc_hir_typeck[fd96d09303487d80]::fn_ctxt::FnCtxt>::check_block_with_expected
  33:     0x7f1ca7e97fec - <rustc_hir_typeck[fd96d09303487d80]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  34:     0x7f1ca7b650a7 - rustc_hir_typeck[fd96d09303487d80]::check::check_fn
  35:     0x7f1ca7710f44 - rustc_hir_typeck[fd96d09303487d80]::typeck
  36:     0x7f1ca77102c7 - rustc_query_impl[d4cc752ff0d73f28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4cc752ff0d73f28]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7f1ca75ed8c3 - rustc_query_system[d117b86e449fcdf2]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc752ff0d73f28]::DynamicConfig<rustc_query_system[d117b86e449fcdf2]::query::caches::VecCache<rustc_span[d159d62802098cb3]::def_id::LocalDefId, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d4cc752ff0d73f28]::plumbing::QueryCtxt, false>
  38:     0x7f1ca75ed550 - rustc_query_impl[d4cc752ff0d73f28]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7f1ca7e7882d - <rustc_middle[3892716d31dc4121]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[53cf90c26ee7bc18]::check_crate::{closure#7}>::{closure#0}
  40:     0x7f1ca7e77025 - rustc_hir_analysis[53cf90c26ee7bc18]::check_crate
  41:     0x7f1ca7bed369 - rustc_interface[1da9c7dc31a5385c]::passes::analysis
  42:     0x7f1ca7becf9d - rustc_query_impl[d4cc752ff0d73f28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4cc752ff0d73f28]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f1ca830f940 - rustc_query_system[d117b86e449fcdf2]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc752ff0d73f28]::DynamicConfig<rustc_query_system[d117b86e449fcdf2]::query::caches::SingleCache<rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d4cc752ff0d73f28]::plumbing::QueryCtxt, false>
  44:     0x7f1ca830f747 - rustc_query_impl[d4cc752ff0d73f28]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f1ca83a8b12 - rustc_interface[1da9c7dc31a5385c]::interface::run_compiler::<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}
  46:     0x7f1ca832b486 - std[76579cbcf5e75e71]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_with_globals<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_pool_with_globals<rustc_interface[1da9c7dc31a5385c]::interface::run_compiler<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>
  47:     0x7f1ca832b2b3 - <<std[76579cbcf5e75e71]::thread::Builder>::spawn_unchecked_<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_with_globals<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_pool_with_globals<rustc_interface[1da9c7dc31a5385c]::interface::run_compiler<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#1} as core[730ecc411c8eaf02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f1ca33988e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hca712a7e6055e033
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
  49:     0x7f1ca33988e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0c4d9df2b2c66b37
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
  50:     0x7f1ca33988e5 - std::sys::unix::thread::Thread::new::thread_start::h42e6b966712cbe95
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f1ca31849eb - <unknown>
  52:     0x7f1ca32087cc - <unknown>
  53:                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: rustc 1.77.0-nightly (2d7be7393 2023-12-23) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [shallow_lint_levels_on] looking up lint levels for `no_arms_or_guards`
#1 [typeck] type-checking `no_arms_or_guards`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors

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

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