Repository: rust
Issue: ICE: forcing query with already existing `DepNode`
Labels: I-ICE,T-compiler,C-bug,S-needs-repro

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

When it happened, I didn't notice it, and I can't reproduce it now.

### Code

```Rust
<code>
```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.76.0-nightly (a96d57bdb 2023-12-15)
binary: rustc
commit-hash: a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01
commit-date: 2023-12-15
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.6
```

### Error output

```
thread 'rustc' panicked at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/compiler/rustc_query_system/src/dep_graph/graph.rs:348:9:
forcing query with already existing `DepNode`
- query-key: DefId(0:2650 ~ airlang[a965]::syntax::parser::escaped::{closure#0})
- dep-node: mir_built(airlang[a965]::syntax::parser::escaped::{closure#0})
stack backtrace:
   0:     0x7fb6ebd72da1 - std::backtrace_rs::backtrace::libunwind::trace::h2af7fc78797d6b12
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fb6ebd72da1 - std::backtrace_rs::backtrace::trace_unsynchronized::h9604b70228537976
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb6ebd72da1 - std::backtrace::Backtrace::create::h5f52ab913c4308cc
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/backtrace.rs:331:13
   3:     0x7fb6ebd72cf0 - std::backtrace::Backtrace::force_capture::hb7301d05676a0ec3
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/backtrace.rs:312:9
   4:     0x7fb6eeb5e5ec - std[b7ef5828bf7979a2]::panicking::update_hook::<alloc[1d06742a918178a6]::boxed::Box<rustc_driver_impl[d295274cbd362baa]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7fb6ebd8e688 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hee408aad194102cb
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/alloc/src/boxed.rs:2029:9
   6:     0x7fb6ebd8e688 - std::panicking::rust_panic_with_hook::h1e5d72ef72ed6a48
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/panicking.rs:783:13
   7:     0x7fb6ebd8e3de - std::panicking::begin_panic_handler::{{closure}}::h1bdff24c098f1c34
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/panicking.rs:657:13
   8:     0x7fb6ebd8b926 - std::sys_common::backtrace::__rust_end_short_backtrace::h157fea401345f7e5
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7fb6ebd8e142 - rust_begin_unwind
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/panicking.rs:645:5
  10:     0x7fb6ebddabd5 - core::panicking::panic_fmt::h45ad530193585f99
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/core/src/panicking.rs:72:14
  11:     0x7fb6f03581bc - rustc_query_system[e290ef3137e90801]::query::plumbing::try_execute_query::<rustc_query_impl[4f4459e7e3302174]::DynamicConfig<rustc_query_system[e290ef3137e90801]::query::caches::VecCache<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, rustc_middle[1676fb5b693515c4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt, true>
  12:     0x7fb6f03548b9 - rustc_query_impl[4f4459e7e3302174]::plumbing::force_from_dep_node::<rustc_query_impl[4f4459e7e3302174]::DynamicConfig<rustc_query_system[e290ef3137e90801]::query::caches::VecCache<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, rustc_middle[1676fb5b693515c4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>>
  13:     0x7fb6f03544ed - <rustc_query_impl[4f4459e7e3302174]::plumbing::query_callback<rustc_query_impl[4f4459e7e3302174]::query_impl::mir_built::QueryType>::{closure#0} as core[cc9db3bcd7193a9a]::ops::function::FnOnce<(rustc_middle[1676fb5b693515c4]::ty::context::TyCtxt, rustc_query_system[e290ef3137e90801]::dep_graph::dep_node::DepNode)>>::call_once
  14:     0x7fb6efe5572d - <rustc_query_system[e290ef3137e90801]::dep_graph::graph::DepGraphData<rustc_middle[1676fb5b693515c4]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt>
  15:     0x7fb6efe556a8 - <rustc_query_system[e290ef3137e90801]::dep_graph::graph::DepGraphData<rustc_middle[1676fb5b693515c4]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt>
  16:     0x7fb6efe556a8 - <rustc_query_system[e290ef3137e90801]::dep_graph::graph::DepGraphData<rustc_middle[1676fb5b693515c4]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt>
  17:     0x7fb6efe556a8 - <rustc_query_system[e290ef3137e90801]::dep_graph::graph::DepGraphData<rustc_middle[1676fb5b693515c4]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt>
  18:     0x7fb6efe549c0 - rustc_query_system[e290ef3137e90801]::query::plumbing::ensure_must_run::<rustc_query_impl[4f4459e7e3302174]::DynamicConfig<rustc_query_system[e290ef3137e90801]::query::caches::VecCache<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, rustc_middle[1676fb5b693515c4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[4f4459e7e3302174]::plumbing::QueryCtxt>
  19:     0x7fb6f08b205a - rustc_query_impl[4f4459e7e3302174]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  20:     0x7fb6eee9fb69 - <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners::<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}
  21:     0x7fb6eee974cd - rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper::<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  22:     0x7fb6eeea0bff - rayon_core[21ce4abbef23c590]::join::join_context::<rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0}
  23:     0x7fb6eee9766c - rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper::<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  24:     0x7fb6eeea0bff - rayon_core[21ce4abbef23c590]::join::join_context::<rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0}
  25:     0x7fb6eee9766c - rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper::<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  26:     0x7fb6eeeb4da2 - <rayon_core[21ce4abbef23c590]::job::StackJob<rayon_core[21ce4abbef23c590]::latch::SpinLatch, rayon_core[21ce4abbef23c590]::join::join_context::call_b<(), rayon[fdcba3c0a92caa7e]::iter::plumbing::bridge_producer_consumer::helper<rayon[fdcba3c0a92caa7e]::slice::IterProducer<rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId>, rayon[fdcba3c0a92caa7e]::iter::for_each::ForEachConsumer<rustc_data_structures[a57b6a2bf0554f71]::sync::parallel::enabled::par_for_each_in<&rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId, &[rustc_span[7aae9d2f085d18e3]::def_id::LocalDefId], <rustc_middle[1676fb5b693515c4]::hir::map::Map>::par_body_owners<rustc_interface[30b841f84a40e793]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}>::{closure#0}, ()> as rayon_core[21ce4abbef23c590]::job::Job>::execute
  27:     0x7fb6ee74e975 - <rayon_core[21ce4abbef23c590]::registry::WorkerThread>::wait_until_cold
  28:     0x7fb6ee74b843 - <rayon_core[21ce4abbef23c590]::registry::ThreadBuilder>::run
  29:     0x7fb6eeb60397 - <<crossbeam_utils[ec868723505f538f]::thread::ScopedThreadBuilder>::spawn<<rayon_core[21ce4abbef23c590]::ThreadPoolBuilder>::build_scoped<rustc_interface[30b841f84a40e793]::util::run_in_thread_pool_with_globals<rustc_interface[30b841f84a40e793]::interface::run_compiler<core[cc9db3bcd7193a9a]::result::Result<(), rustc_span[7aae9d2f085d18e3]::ErrorGuaranteed>, rustc_driver_impl[d295274cbd362baa]::run_compiler::{closure#0}>::{closure#0}, core[cc9db3bcd7193a9a]::result::Result<(), rustc_span[7aae9d2f085d18e3]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[30b841f84a40e793]::util::run_in_thread_pool_with_globals<rustc_interface[30b841f84a40e793]::interface::run_compiler<core[cc9db3bcd7193a9a]::result::Result<(), rustc_span[7aae9d2f085d18e3]::ErrorGuaranteed>, rustc_driver_impl[d295274cbd362baa]::run_compiler::{closure#0}>::{closure#0}, core[cc9db3bcd7193a9a]::result::Result<(), rustc_span[7aae9d2f085d18e3]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}, core[cc9db3bcd7193a9a]::result::Result<(), rustc_span[7aae9d2f085d18e3]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[cc9db3bcd7193a9a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7fb6eeb563ce - std[b7ef5828bf7979a2]::sys_common::backtrace::__rust_begin_short_backtrace::<alloc[1d06742a918178a6]::boxed::Box<dyn core[cc9db3bcd7193a9a]::ops::function::FnOnce<(), Output = ()> + core[cc9db3bcd7193a9a]::marker::Send>, ()>
  31:     0x7fb6eeb60023 - <<std[b7ef5828bf7979a2]::thread::Builder>::spawn_unchecked_<alloc[1d06742a918178a6]::boxed::Box<dyn core[cc9db3bcd7193a9a]::ops::function::FnOnce<(), Output = ()> + core[cc9db3bcd7193a9a]::marker::Send>, ()>::{closure#1} as core[cc9db3bcd7193a9a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7fb6ebd98515 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9b684dfd852f9ea9
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/alloc/src/boxed.rs:2015:9
  33:     0x7fb6ebd98515 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd37b13ace79f6297
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/alloc/src/boxed.rs:2015:9
  34:     0x7fb6ebd98515 - std::sys::unix::thread::Thread::new::thread_start::hcd61fdfe81c56ff4
                               at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7fb6eba9b9eb - <unknown>
  36:     0x7fb6ebb1f7cc - <unknown>
  37:                0x0 - <unknown>


rustc version: 1.76.0-nightly (a96d57bdb 2023-12-15)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_built] building MIR for `syntax::parser::escaped::{closure#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
<backtrace>
```

</p>
</details>