Skip to content

ICE: ast lowering: no entry for node id: NodeId(26) #118697

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
matthiaskrgr opened this issue Dec 7, 2023 · 2 comments · Fixed by #119042
Closed

ICE: ast lowering: no entry for node id: NodeId(26) #118697

matthiaskrgr opened this issue Dec 7, 2023 · 2 comments · Fixed by #119042
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):

struct Foo {
    bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
}

original:

// check-pass

struct Foo {
    bar: dyn for<v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u))> Fn(usize, &'r dyn FnMut())
}

fn main() {
}

Version information

rustc 1.76.0-nightly (f32d29837 2023-12-06)
binary: rustc
commit-hash: f32d29837d3642475e23716cd8af5711d00c01ae
commit-date: 2023-12-06
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

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

Program output

error[E0412]: cannot find type `Bar2` in this scope
 --> /tmp/icemaker_global_tempdir.LGGj7oNEUv0I/rustc_testrunner_tmpdir_reporting.D9qzUEL9qA9w/mvce.rs:2:22
  |
2 |     bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
  |                      ^^^^ not found in this scope

error[E0412]: cannot find type `NoisyDrop` in this scope
 --> /tmp/icemaker_global_tempdir.LGGj7oNEUv0I/rustc_testrunner_tmpdir_reporting.D9qzUEL9qA9w/mvce.rs:2:28
  |
2 |     bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
  |                            ^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `u` in this scope
 --> /tmp/icemaker_global_tempdir.LGGj7oNEUv0I/rustc_testrunner_tmpdir_reporting.D9qzUEL9qA9w/mvce.rs:2:39
  |
2 |     bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
  |                                       ^ help: a builtin type with a similar name exists: `u8`

error[E0658]: only lifetime parameters can be used in this context
 --> /tmp/icemaker_global_tempdir.LGGj7oNEUv0I/rustc_testrunner_tmpdir_reporting.D9qzUEL9qA9w/mvce.rs:2:18
  |
2 |     bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
  |                  ^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable

warning: type parameter `v` should have an upper camel case name
 --> /tmp/icemaker_global_tempdir.LGGj7oNEUv0I/rustc_testrunner_tmpdir_reporting.D9qzUEL9qA9w/mvce.rs:2:18
  |
2 |     bar: dyn for<v = Bar2(&NoisyDrop(&u))> Fn(usize),
  |                  ^ help: convert the identifier to upper camel case (notice the capitalization): `V`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

thread 'rustc' panicked at compiler/rustc_ast_lowering/src/lib.rs:553:55:
no entry for node id: `NodeId(26)`
stack backtrace:
   0:     0x7ff74c98b45c - std::backtrace_rs::backtrace::libunwind::trace::h05b6a3fdb7984b42
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7ff74c98b45c - std::backtrace_rs::backtrace::trace_unsynchronized::h598b668ef45ec588
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff74c98b45c - std::sys_common::backtrace::_print_fmt::hbefb24ad1b1e1b2a
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ff74c98b45c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4780316eb305e509
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff74c9de4a0 - core::fmt::rt::Argument::fmt::h5cb309a7c172eabe
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/core/src/fmt/rt.rs:142:9
   5:     0x7ff74c9de4a0 - core::fmt::write::h6308397b9e39079a
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/core/src/fmt/mod.rs:1120:17
   6:     0x7ff74c97f34f - std::io::Write::write_fmt::ha9de23c18c6ad43b
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/io/mod.rs:1810:15
   7:     0x7ff74c98b244 - std::sys_common::backtrace::_print::h12314f11f05d3175
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff74c98b244 - std::sys_common::backtrace::print::h2ee0c1070160e61c
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff74c98ded7 - std::panicking::default_hook::{{closure}}::h8e9e3d82075b4ca5
  10:     0x7ff74c98dc3f - std::panicking::default_hook::hc6307ef37ca7e274
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/panicking.rs:292:9
  11:     0x7ff74f6f6f30 - std[f19864afa78103cd]::panicking::update_hook::<alloc[2aa8f2c60f7e6c66]::boxed::Box<rustc_driver_impl[5d68deab5a6eda66]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ff74c98e618 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1331fce690faa3ac
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/alloc/src/boxed.rs:2021:9
  13:     0x7ff74c98e618 - std::panicking::rust_panic_with_hook::h966b13c595fb6a12
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/panicking.rs:783:13
  14:     0x7ff74c98e36e - std::panicking::begin_panic_handler::{{closure}}::hfef9796ac34a1d90
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/panicking.rs:657:13
  15:     0x7ff74c98b926 - std::sys_common::backtrace::__rust_end_short_backtrace::h3b5384eeaf17c0a1
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7ff74c98e0d2 - rust_begin_unwind
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/panicking.rs:645:5
  17:     0x7ff74c9dab65 - core::panicking::panic_fmt::h4a9c5999dba52929
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/core/src/panicking.rs:72:14
  18:     0x7ff750b6e4ec - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::new_named_lifetime
  19:     0x7ff750e7f79d - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_ty_direct
  20:     0x7ff7510bf842 - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_qpath
  21:     0x7ff750e7ec4b - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_ty_direct
  22:     0x7ff750b6f3b8 - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_generic_param
  23:     0x7ff751578f6e - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_lifetime_binder
  24:     0x7ff751579121 - rustc_arena[bcd5f08e463cc141]::outline::<<rustc_arena[bcd5f08e463cc141]::DroplessArena>::alloc_from_iter<rustc_hir[7a507a68aaeae313]::hir::PolyTraitRef, core[c98a5e2a9f438e2a]::iter::adapters::filter_map::FilterMap<core[c98a5e2a9f438e2a]::slice::iter::Iter<rustc_ast[1299bb691959ba4c]::ast::GenericBound>, <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_ty_direct::{closure#2}::{closure#0}>>::{closure#0}, &mut [rustc_hir[7a507a68aaeae313]::hir::PolyTraitRef]>
  25:     0x7ff750e80633 - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_ty_direct
  26:     0x7ff750e846be - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_field_def
  27:     0x7ff750e83938 - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_variant_data
  28:     0x7ff7516366f8 - <rustc_ast_lowering[a74689958c439adf]::LoweringContext>::lower_item_kind
  29:     0x7ff750fa2665 - <rustc_ast_lowering[a74689958c439adf]::item::ItemLowerer>::lower_node
  30:     0x7ff75162f23d - rustc_ast_lowering[a74689958c439adf]::lower_to_hir
  31:     0x7ff75162e878 - rustc_query_impl[516b0f6d3c576e47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[516b0f6d3c576e47]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 8usize]>>
  32:     0x7ff7518ba1b2 - rustc_query_system[63b2eb5e5eb99e14]::query::plumbing::try_execute_query::<rustc_query_impl[516b0f6d3c576e47]::DynamicConfig<rustc_query_system[63b2eb5e5eb99e14]::query::caches::SingleCache<rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[516b0f6d3c576e47]::plumbing::QueryCtxt, false>
  33:     0x7ff7518b9dc6 - rustc_query_impl[516b0f6d3c576e47]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7ff750c86049 - rustc_query_impl[516b0f6d3c576e47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[516b0f6d3c576e47]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7ff750c855e7 - rustc_query_system[63b2eb5e5eb99e14]::query::plumbing::try_execute_query::<rustc_query_impl[516b0f6d3c576e47]::DynamicConfig<rustc_query_system[63b2eb5e5eb99e14]::query::caches::VecCache<rustc_hir[7a507a68aaeae313]::hir_id::OwnerId, rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[516b0f6d3c576e47]::plumbing::QueryCtxt, false>
  36:     0x7ff750c85350 - rustc_query_impl[516b0f6d3c576e47]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7ff750a171f3 - <rustc_middle[abf3d24358494a96]::hir::map::Map>::attrs
  38:     0x7ff7518b7987 - rustc_passes[4b026eee6960c442]::entry::entry_fn
  39:     0x7ff7518b7918 - rustc_query_impl[516b0f6d3c576e47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[516b0f6d3c576e47]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 12usize]>>
  40:     0x7ff7518b78eb - <rustc_query_impl[516b0f6d3c576e47]::query_impl::entry_fn::dynamic_query::{closure#2} as core[c98a5e2a9f438e2a]::ops::function::FnOnce<(rustc_middle[abf3d24358494a96]::ty::context::TyCtxt, ())>>::call_once
  41:     0x7ff7518b7083 - rustc_query_system[63b2eb5e5eb99e14]::query::plumbing::try_execute_query::<rustc_query_impl[516b0f6d3c576e47]::DynamicConfig<rustc_query_system[63b2eb5e5eb99e14]::query::caches::SingleCache<rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[516b0f6d3c576e47]::plumbing::QueryCtxt, false>
  42:     0x7ff7518b6e4f - rustc_query_impl[516b0f6d3c576e47]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7ff7512c301f - rustc_interface[403c7d9aab312e25]::passes::analysis
  44:     0x7ff7512c2f1d - rustc_query_impl[516b0f6d3c576e47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[516b0f6d3c576e47]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7ff751960a00 - rustc_query_system[63b2eb5e5eb99e14]::query::plumbing::try_execute_query::<rustc_query_impl[516b0f6d3c576e47]::DynamicConfig<rustc_query_system[63b2eb5e5eb99e14]::query::caches::SingleCache<rustc_middle[abf3d24358494a96]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[516b0f6d3c576e47]::plumbing::QueryCtxt, false>
  46:     0x7ff751960807 - rustc_query_impl[516b0f6d3c576e47]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7ff75196f0e2 - rustc_interface[403c7d9aab312e25]::interface::run_compiler::<core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>, rustc_driver_impl[5d68deab5a6eda66]::run_compiler::{closure#0}>::{closure#0}
  48:     0x7ff7519624c9 - std[f19864afa78103cd]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[403c7d9aab312e25]::util::run_in_thread_with_globals<rustc_interface[403c7d9aab312e25]::util::run_in_thread_pool_with_globals<rustc_interface[403c7d9aab312e25]::interface::run_compiler<core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>, rustc_driver_impl[5d68deab5a6eda66]::run_compiler::{closure#0}>::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>
  49:     0x7ff7519622f3 - <<std[f19864afa78103cd]::thread::Builder>::spawn_unchecked_<rustc_interface[403c7d9aab312e25]::util::run_in_thread_with_globals<rustc_interface[403c7d9aab312e25]::util::run_in_thread_pool_with_globals<rustc_interface[403c7d9aab312e25]::interface::run_compiler<core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>, rustc_driver_impl[5d68deab5a6eda66]::run_compiler::{closure#0}>::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c98a5e2a9f438e2a]::result::Result<(), rustc_span[24843a324ed31ab0]::ErrorGuaranteed>>::{closure#1} as core[c98a5e2a9f438e2a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7ff74c9984a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha603a9d78630b4d9
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/alloc/src/boxed.rs:2007:9
  51:     0x7ff74c9984a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdd9615f963a03fca
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/alloc/src/boxed.rs:2007:9
  52:     0x7ff74c9984a5 - std::sys::unix::thread::Thread::new::thread_start::h15fde3375b9b660d
                               at /rustc/f32d29837d3642475e23716cd8af5711d00c01ae/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7ff74c7889eb - <unknown>
  54:     0x7ff74c80c7cc - <unknown>
  55:                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.76.0-nightly (f32d29837 2023-12-06) 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 4 previous errors; 1 warning emitted

Some errors have detailed explanations: E0412, E0658.
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 Dec 7, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 7, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2022-06-23

commit[0] 2022-06-21: Auto merge of #98098 - bjorn3:archive_refactor, r=michaelwoerister
commit[1] 2022-06-22: Auto merge of #98359 - JohnTitor:rollup-v30vyzr, r=JohnTitor
commit[2] 2022-06-22: Auto merge of #97853 - TaKO8Ki:emit-only-one-note-per-unused-struct-field, r=estebank
commit[3] 2022-06-22: Auto merge of #98375 - JohnTitor:rollup-e5c6rgo, r=JohnTitor
commit[4] 2022-06-22: Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkov

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 7, 2023
@spastorino
Copy link
Member

We have a LifetimeRes::Fresh and we are calling local_def_id for the recorded node_id without previously calling lifetime_res_to_generic_param to generate the expected def_id.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 26, 2023
…rrors

fallback `default` to `None` during ast-lowering for lifetime binder

Fixes rust-lang#118697

This is another attempt. It has a fallback, setting `default` to `None` and emit an error for non-lifetime binders during ast lowering.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 26, 2023
fallback `default` to `None` during ast-lowering for lifetime binder

Fixes rust-lang#118697

This is another attempt. It has a fallback, setting `default` to `None` and emit an error for non-lifetime binders during ast lowering.

r? `@compiler-errors`
@bors bors closed this as completed in a75fed7 Dec 26, 2023
# for free to join this conversation on GitHub. Already have an account? # 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
4 participants