rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.11k stars 12.8k forks source link

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

Open matthiaskrgr opened 8 months ago

matthiaskrgr commented 8 months ago

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>)>>, | ------------------------------^^^^^^^^^^^^^^^^^^^^^--- | | | | | 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>)>>, | ^^^^^^^^^^^^^^^^^^^^^ | = 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 - ::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::>::{closure#0} 12: 0x76d7725a4150 - as core::ops::function::Fn>::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 - ::lower_ty_direct 19: 0x76d76ea993a1 - ::lower_ty 20: 0x76d770cf3d4b - ::lower_fn_decl 21: 0x76d770cf0297 - ::lower_method_sig 22: 0x76d7706e85ca - ::lower_assoc_item 23: 0x76d7706fadb7 - ::lower_node 24: 0x76d7706f7e56 - rustc_ast_lowering[a8530f55dbeea654]::lower_to_hir 25: 0x76d770ff03a0 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::> 26: 0x76d770fedff4 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::>, 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::> 29: 0x76d77092165b - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::>, 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 - ::attrs 32: 0x76d771156903 - rustc_passes[6bc16bb8b9e07277]::entry::entry_fn 33: 0x76d771156898 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::> 34: 0x76d771156873 - >::call_once 35: 0x76d77115618a - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::>, 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::> 39: 0x76d770feb4a5 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::>, 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::, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0} 42: 0x76d770f52399 - std[48784e9e46568672]::sys_common::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::h3e016c41180ed802 at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9 45: 0x76d7725ad919 - as core::ops::function::FnOnce>::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 - 48: 0x76d7723caa3c - 49: 0x0 - 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 commented 8 months ago

:thinking: Regression in nightly-2022-07-26

fetching (via remote github) commits from max(7fe022f5aa32bbbb33c3a58755729d6667a461a9, 2022-07-23) to 6dbae3ad19309bb541d9e76638e6aa4b5449f29a ending github query because we found starting sha: 7fe022f5aa32bbbb33c3a58755729d6667a461a9 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 7fe022f5aa32bbbb33c3a58755729d6667a461a9 and 6dbae3ad19309bb541d9e76638e6aa4b5449f29a within last 167 days

adetaylor commented 6 months ago

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, #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 #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 commented 6 months ago

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 commented 6 months ago

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