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 entry for node id: 'NodeId(53)' #122903

Open
matthiaskrgr opened this issue Mar 22, 2024 · 4 comments
Open

ICE: no entry for node id: 'NodeId(53)' #122903

matthiaskrgr opened this issue Mar 22, 2024 · 4 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) 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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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):

impl Struct {
    async fn box_box_ref_Struct(
        self: Box<Box<Self, impl FnMut(&mut Box<Box<Self, impl FnMut(&mut Self)>>)>>,
    ) -> &u32 {
        f
    }
}

original:

impl Struct {
    async fn box_box_ref_Struct(self: Box<Box<Self, impl FnMut(&mut Box<Box<Self, impl FnMut(&mut Self)>>)>>) -> &u32 {
        f
    }
}

Version information

rustc 1.79.0-nightly (b3df0d7e5 2024-03-22)
binary: rustc
commit-hash: b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87
commit-date: 2024-03-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

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

Program output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/icemaker_global_tempdir.13jse2WQq2WY/rustc_testrunner_tmpdir_reporting.UjIokzyPm1t9/mvce.rs:2:5
  |
2 |     async fn box_box_ref_Struct(
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0666]: nested `impl Trait` is not allowed
 --> /tmp/icemaker_global_tempdir.13jse2WQq2WY/rustc_testrunner_tmpdir_reporting.UjIokzyPm1t9/mvce.rs:3:59
  |
3 |         self: Box<Box<Self, impl FnMut(&mut Box<Box<Self, impl FnMut(&mut Self)>>)>>,
  |                             ------------------------------^^^^^^^^^^^^^^^^^^^^^---
  |                             |                             |
  |                             |                             nested `impl Trait` here
  |                             outer `impl Trait`

error[E0412]: cannot find type `Struct` in this scope
 --> /tmp/icemaker_global_tempdir.13jse2WQq2WY/rustc_testrunner_tmpdir_reporting.UjIokzyPm1t9/mvce.rs:1:6
  |
1 | impl Struct {
  |      ^^^^^^ not found in this scope

error[E0425]: cannot find value `f` in this scope
 --> /tmp/icemaker_global_tempdir.13jse2WQq2WY/rustc_testrunner_tmpdir_reporting.UjIokzyPm1t9/mvce.rs:5:9
  |
5 |         f
  |         ^ not found in this scope

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
 --> /tmp/icemaker_global_tempdir.13jse2WQq2WY/rustc_testrunner_tmpdir_reporting.UjIokzyPm1t9/mvce.rs:3:59
  |
3 |         self: Box<Box<Self, impl FnMut(&mut Box<Box<Self, impl FnMut(&mut Self)>>)>>,
  |                                                           ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `impl Trait` is only allowed in arguments and return types of functions and methods

thread 'rustc' panicked at compiler/rustc_ast_lowering/src/lib.rs:531:55:
no entry for node id: `NodeId(51)`
stack backtrace:
   0:     0x76d7725a0fa5 - std::backtrace_rs::backtrace::libunwind::trace::h4515e3e00f57996f
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x76d7725a0fa5 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e64ac1112175e4e
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x76d7725a0fa5 - std::sys_common::backtrace::_print_fmt::h182160b5ad873150
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x76d7725a0fa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h432843f19f8b2b6d
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x76d7725f1feb - core::fmt::rt::Argument::fmt::hb59bbd21accf1885
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/rt.rs:142:9
   5:     0x76d7725f1feb - core::fmt::write::haf243cf4605e411d
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/mod.rs:1153:17
   6:     0x76d772595d3f - std::io::Write::write_fmt::hd8c8c68b4f5b8f11
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/io/mod.rs:1843:15
   7:     0x76d7725a0d7e - std::sys_common::backtrace::_print::h0ec933d6103e5515
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x76d7725a0d7e - std::sys_common::backtrace::print::h55136fa64edb86e6
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x76d7725a39f9 - std::panicking::default_hook::{{closure}}::h28cbeefc01b40f52
  10:     0x76d7725a3763 - std::panicking::default_hook::h15e904210c67a3ca
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:292:9
  11:     0x76d76edcb6bf - std[48784e9e46568672]::panicking::update_hook::<alloc[590c7545ac68a568]::boxed::Box<rustc_driver_impl[9e9e6466696ec967]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x76d7725a4150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::had664932fcaf7f86
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2029:9
  13:     0x76d7725a4150 - std::panicking::rust_panic_with_hook::h9f23cc8a1f418825
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:783:13
  14:     0x76d7725a3ea6 - std::panicking::begin_panic_handler::{{closure}}::h6c297ce5a3207845
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:657:13
  15:     0x76d7725a1469 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e27b03308c1610a
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x76d7725a3bd7 - rust_begin_unwind
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:645:5
  17:     0x76d7725ee486 - core::panicking::panic_fmt::hc62934eef5acbd79
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/panicking.rs:72:14
  18:     0x76d770cf65de - <rustc_ast_lowering[a8530f55dbeea654]::LoweringContext>::lower_ty_direct
  19:     0x76d76ea993a1 - <rustc_ast_lowering[a8530f55dbeea654]::LoweringContext>::lower_ty
  20:     0x76d770cf3d4b - <rustc_ast_lowering[a8530f55dbeea654]::LoweringContext>::lower_fn_decl
  21:     0x76d770cf0297 - <rustc_ast_lowering[a8530f55dbeea654]::LoweringContext>::lower_method_sig
  22:     0x76d7706e85ca - <rustc_ast_lowering[a8530f55dbeea654]::LoweringContext>::lower_assoc_item
  23:     0x76d7706fadb7 - <rustc_ast_lowering[a8530f55dbeea654]::item::ItemLowerer>::lower_node
  24:     0x76d7706f7e56 - rustc_ast_lowering[a8530f55dbeea654]::lower_to_hir
  25:     0x76d770ff03a0 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>
  26:     0x76d770fedff4 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::SingleCache<rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
  27:     0x76d770fedbe0 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  28:     0x76d7709220c3 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>
  29:     0x76d77092165b - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::VecCache<rustc_hir[a67f1a97fc26ff83]::hir_id::OwnerId, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
  30:     0x76d7709213c9 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  31:     0x76d7703b5b2a - <rustc_middle[cfd7f582085b2efd]::hir::map::Map>::attrs
  32:     0x76d771156903 - rustc_passes[6bc16bb8b9e07277]::entry::entry_fn
  33:     0x76d771156898 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 12usize]>>
  34:     0x76d771156873 - <rustc_query_impl[82a63e1d7cdec9a7]::query_impl::entry_fn::dynamic_query::{closure#2} as core[b4a1350c838fc0f9]::ops::function::FnOnce<(rustc_middle[cfd7f582085b2efd]::ty::context::TyCtxt, ())>>::call_once
  35:     0x76d77115618a - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::SingleCache<rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
  36:     0x76d771155f45 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  37:     0x76d7706a002e - rustc_interface[7ddcde71cf02e108]::passes::analysis
  38:     0x76d77069fe51 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>
  39:     0x76d770feb4a5 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::SingleCache<rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
  40:     0x76d770feb209 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x76d770e870d9 - rustc_interface[7ddcde71cf02e108]::interface::run_compiler::<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}
  42:     0x76d770f52399 - std[48784e9e46568672]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>
  43:     0x76d770f521c6 - <<std[48784e9e46568672]::thread::Builder>::spawn_unchecked_<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#1} as core[b4a1350c838fc0f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x76d7725ad919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3e016c41180ed802
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
  45:     0x76d7725ad919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf0716ba35a33b0c
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
  46:     0x76d7725ad919 - std::sys::pal::unix::thread::Thread::new::thread_start::hd585680968d21553
                               at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys/pal/unix/thread.rs:108:17
  47:     0x76d77234d55a - <unknown>
  48:     0x76d7723caa3c - <unknown>
  49:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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.79.0-nightly (b3df0d7e5 2024-03-22) 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 ``
#2 [entry_fn] looking up the entry function of a crate
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0412, E0425, E0562, E0666, E0670.
For more information about an error, try `rustc --explain E0412`.

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

🤔
Regression in nightly-2022-07-26

fetching (via remote github) commits from max(7fe022f, 2022-07-23) to 6dbae3a
ending github query because we found starting sha: 7fe022f
get_commits_between returning commits, len: 10
commit[0] 2022-07-24: Auto merge of #99687 - RalfJung:rollup-bojacrc, r=RalfJung
commit[1] 2022-07-24: Auto merge of #99603 - fasterthanlime:ra-subtree-2, r=jyn514
commit[2] 2022-07-25: Auto merge of #97581 - AngelicosPhosphoros:improve_calloc_check_in_vec_macro_for_tuples, r=Mark-Simulacrum
commit[3] 2022-07-25: Auto merge of #99676 - thomcc:dont-overwrite, r=tmiasko
commit[4] 2022-07-25: Auto merge of #98770 - klensy:no-string-dupes-ugly, r=cjgillot
commit[5] 2022-07-25: Auto merge of #99600 - tmiasko:subst-folder, r=petrochenkov
commit[6] 2022-07-25: Auto merge of #99707 - JohnTitor:rollup-74rb8vq, r=JohnTitor
commit[7] 2022-07-25: Auto merge of #85673 - csmoe:export-exe-sym, r=bjorn3
commit[8] 2022-07-25: Auto merge of #99722 - RalfJung:miri, r=RalfJung
commit[9] 2022-07-25: Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov
ERROR: no CI builds available between 7fe022f and 6dbae3a within last 167 days

@jieyouxu jieyouxu added A-frontend Area: Compiler frontend (errors, parsing and HIR) S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 4, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@adetaylor
Copy link
Contributor

Hi @cjgillot , could I have your advice here? It looks like #97313 probably introduced this ICE. I'm trying to make progress with #117967, which in turn is a pre-requisite for #44874, but unfortunately #117967 accidentally fixes this ICE by rejecting this complex function signature, and I guess that's no good because we won't have a reproduction case for this bug any more.

I think the options are:

  1. We decide that this ICE is only possible due to multiple references within the self type. In which case, Fix ambiguous cases of multiple & in elided self lifetimes #117967 will fix this, and everyone is happy.
  2. We decide that this ICE is possible even without multiple references within the self type, in which case Fix ambiguous cases of multiple & in elided self lifetimes #117967 doesn't help, but we should be able to find another test case.

Do you have any clues which it is? Should I be trying to find an alternative way to trigger this ICE or should I stop worrying and be happy?

@adetaylor
Copy link
Contributor

adetaylor commented May 30, 2024

Here's a test case I've manually reduced further.

impl Struct {
    fn box_box_ref_Struct(
        self: impl FnMut(Box<impl FnMut(&mut Self)>),
    ) -> &u32 {
        f
    }
}

So I think that means it's case 2 above, and I should be able to reproduce this crash even after the changes in #117967.

@adetaylor
Copy link
Contributor

OK - commits 6287c94 and 8c17777, within #117967, hopefully adjust this test to continue to reproduce the ICE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) 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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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