Repository: rust
Issue: thread 'rustc' panicked at 'forcing query with already existing `DepNode`
Labels: I-ICE,T-compiler,C-bug

<!--
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/
-->

### 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.67.0-nightly (e75aab045 2022-11-09)
binary: rustc
commit-hash: e75aab045fc476f176a58c408f6b06f0e275c6e1
commit-date: 2022-11-09
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4
```

### Error output

```
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, constness: NotConst }, value: Binder(TraitPredicate(<for<'a, 'b, 'c, 'd, 'e, 'f> {std::future::ResumeTy, &'a mut (dyn rbdc::db::Connection + 'b), &'c mut std::boxed::Box<(dyn rbdc::db::Connection + 'd)>, &'e str, std::vec::Vec<rbs::Value>, std::pin::Pin<std::boxed::Box<(dyn futures_core::Future<Output = std::result::Result<rbdc::db::ExecResult, rbdc::Error>> + std::marker::Send + 'f)>>, ()} as std::marker::Send>, polarity:Positive), []) } }
- dep-node: evaluate_obligation(4ea368f0dd25d937-61d89953b63c2540)', /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/compiler/rustc_query_system/src/dep_graph/graph.rs:316:9

```

<!--
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>

```
stack backtrace:
   0:        0x10e4d5f12 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b594e9bcc0c6898
   1:        0x10e5344ba - core::fmt::write::h7c6f83d024852aa9
   2:        0x10e4c7fec - std::io::Write::write_fmt::h97d969d4aea1606d
   3:        0x10e4d5cda - std::sys_common::backtrace::print::h562dadf6028256bf
   4:        0x10e4d90b6 - std::panicking::default_hook::{{closure}}::hee367e24075678e4
   5:        0x10e4d8e07 - std::panicking::default_hook::hcce3553a0befadd1
   6:        0x11717af3d - rustc_driver[f93b8a3886cc8b65]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10e4d98b5 - std::panicking::rust_panic_with_hook::h4f6feaafc55c56a2
   8:        0x10e4d9643 - std::panicking::begin_panic_handler::{{closure}}::hde5e87cf8416de78
   9:        0x10e4d63a8 - std::sys_common::backtrace::__rust_end_short_backtrace::h06c292cffdb0bbc3
  10:        0x10e4d930d - _rust_begin_unwind
  11:        0x10e561053 - core::panicking::panic_fmt::he51d66482c616f28
  12:        0x11ac534e0 - <rustc_query_system[38b064a260926677]::dep_graph::graph::DepGraph<rustc_middle[85091bb6846d2e9a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[85091bb6846d2e9a]::ty::context::TyCtxt, rustc_middle[85091bb6846d2e9a]::infer::canonical::Canonical<rustc_middle[85091bb6846d2e9a]::ty::ParamEnvAnd<rustc_middle[85091bb6846d2e9a]::ty::Predicate>>, core[322641b34a183a]::result::Result<rustc_middle[85091bb6846d2e9a]::traits::select::EvaluationResult, rustc_middle[85091bb6846d2e9a]::traits::select::OverflowError>>
  13:        0x11a957d5d - rustc_query_system[38b064a260926677]::query::plumbing::try_execute_query::<rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt, rustc_query_system[38b064a260926677]::query::caches::DefaultCache<rustc_middle[85091bb6846d2e9a]::infer::canonical::Canonical<rustc_middle[85091bb6846d2e9a]::ty::ParamEnvAnd<rustc_middle[85091bb6846d2e9a]::ty::Predicate>>, core[322641b34a183a]::result::Result<rustc_middle[85091bb6846d2e9a]::traits::select::EvaluationResult, rustc_middle[85091bb6846d2e9a]::traits::select::OverflowError>>>
  14:        0x11aa68d1d - rustc_query_system[38b064a260926677]::query::plumbing::get_query::<rustc_query_impl[fcf86a589ba14889]::queries::evaluate_obligation, rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt>
  15:        0x11ab1d509 - <rustc_query_impl[fcf86a589ba14889]::Queries as rustc_middle[85091bb6846d2e9a]::ty::query::QueryEngine>::evaluate_obligation
  16:        0x11b671df9 - <rustc_infer[f3d18b0d0d8e0a5e]::infer::InferCtxt as rustc_trait_selection[fbfc9000665c881]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  17:        0x11b671eef - <rustc_infer[f3d18b0d0d8e0a5e]::infer::InferCtxt as rustc_trait_selection[fbfc9000665c881]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  18:        0x11b6c0b4d - <rustc_trait_selection[fbfc9000665c881]::traits::fulfill::FulfillProcessor>::process_trait_obligation
  19:        0x11b6c02e2 - <rustc_trait_selection[fbfc9000665c881]::traits::fulfill::FulfillProcessor as rustc_data_structures[2eed7d44fa552923]::obligation_forest::ObligationProcessor>::process_obligation
  20:        0x11b64dc46 - <rustc_data_structures[2eed7d44fa552923]::obligation_forest::ObligationForest<rustc_trait_selection[fbfc9000665c881]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[fbfc9000665c881]::traits::fulfill::FulfillProcessor>
  21:        0x11b6bc23a - <rustc_trait_selection[fbfc9000665c881]::traits::fulfill::FulfillmentContext as rustc_infer[f3d18b0d0d8e0a5e]::traits::engine::TraitEngine>::select_where_possible
  22:        0x11b6bc10a - <rustc_trait_selection[fbfc9000665c881]::traits::fulfill::FulfillmentContext as rustc_infer[f3d18b0d0d8e0a5e]::traits::engine::TraitEngine>::select_all_or_error
  23:        0x1199e82f1 - <rustc_hir_typeck[bdb15a1f3923c127]::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  24:        0x119ac2b93 - <rustc_hir_typeck[bdb15a1f3923c127]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[bdb15a1f3923c127]::typeck_with_fallback<rustc_hir_typeck[bdb15a1f3923c127]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[85091bb6846d2e9a]::ty::context::TypeckResults>
  25:        0x119a5bffa - rustc_hir_typeck[bdb15a1f3923c127]::typeck
  26:        0x11ac5fc38 - <rustc_query_system[38b064a260926677]::dep_graph::graph::DepGraph<rustc_middle[85091bb6846d2e9a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[85091bb6846d2e9a]::ty::context::TyCtxt, rustc_span[50ad8565b2f1bbfb]::def_id::LocalDefId, &rustc_middle[85091bb6846d2e9a]::ty::context::TypeckResults>
  27:        0x11a96e2fd - rustc_query_system[38b064a260926677]::query::plumbing::try_execute_query::<rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt, rustc_query_system[38b064a260926677]::query::caches::DefaultCache<rustc_span[50ad8565b2f1bbfb]::def_id::LocalDefId, &rustc_middle[85091bb6846d2e9a]::ty::context::TypeckResults>>
  28:        0x11aa73b8c - rustc_query_system[38b064a260926677]::query::plumbing::get_query::<rustc_query_impl[fcf86a589ba14889]::queries::typeck, rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt>
  29:        0x119aeb76c - std[38dd6138ba148cb2]::panicking::try::<(), core[322641b34a183a]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[2eed7d44fa552923]::sync::par_for_each_in<&[rustc_span[50ad8565b2f1bbfb]::def_id::LocalDefId], <rustc_middle[85091bb6846d2e9a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[bdb15a1f3923c127]::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  30:        0x119aeb4a5 - rustc_data_structures[2eed7d44fa552923]::sync::par_for_each_in::<&[rustc_span[50ad8565b2f1bbfb]::def_id::LocalDefId], <rustc_middle[85091bb6846d2e9a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[bdb15a1f3923c127]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:        0x119a5b77d - rustc_hir_typeck[bdb15a1f3923c127]::typeck_item_bodies
  32:        0x11aca288d - <rustc_query_system[38b064a260926677]::dep_graph::graph::DepGraph<rustc_middle[85091bb6846d2e9a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[85091bb6846d2e9a]::ty::context::TyCtxt, (), ()>
  33:        0x11aa081cb - rustc_query_system[38b064a260926677]::query::plumbing::try_execute_query::<rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt, rustc_query_system[38b064a260926677]::query::caches::DefaultCache<(), ()>>
  34:        0x11aa68339 - rustc_query_system[38b064a260926677]::query::plumbing::get_query::<rustc_query_impl[fcf86a589ba14889]::queries::typeck_item_bodies, rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt>
  35:        0x119bd43f4 - <rustc_session[304ed9bc7c986c94]::session::Session>::time::<(), rustc_hir_analysis[e85e3b9a54dc24a9]::check_crate::{closure#7}>
  36:        0x119cf35df - rustc_hir_analysis[e85e3b9a54dc24a9]::check_crate
  37:        0x11723e3ba - rustc_interface[bab52cec3fba6e57]::passes::analysis
  38:        0x11ac9594a - <rustc_query_system[38b064a260926677]::dep_graph::graph::DepGraph<rustc_middle[85091bb6846d2e9a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[85091bb6846d2e9a]::ty::context::TyCtxt, (), core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>
  39:        0x11a9f9f9e - rustc_query_system[38b064a260926677]::query::plumbing::try_execute_query::<rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt, rustc_query_system[38b064a260926677]::query::caches::DefaultCache<(), core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>>
  40:        0x11aa73f39 - rustc_query_system[38b064a260926677]::query::plumbing::get_query::<rustc_query_impl[fcf86a589ba14889]::queries::analysis, rustc_query_impl[fcf86a589ba14889]::plumbing::QueryCtxt>
  41:        0x11710a416 - <rustc_interface[bab52cec3fba6e57]::passes::QueryContext>::enter::<rustc_driver[f93b8a3886cc8b65]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>
  42:        0x11714e68d - rustc_span[50ad8565b2f1bbfb]::with_source_map::<core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>, rustc_interface[bab52cec3fba6e57]::interface::run_compiler<core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>, rustc_driver[f93b8a3886cc8b65]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  43:        0x11713e5bc - <scoped_tls[5d80669e9829205e]::ScopedKey<rustc_span[50ad8565b2f1bbfb]::SessionGlobals>>::set::<rustc_interface[bab52cec3fba6e57]::interface::run_compiler<core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>, rustc_driver[f93b8a3886cc8b65]::run_compiler::{closure#1}>::{closure#0}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>
  44:        0x11710d37a - std[38dd6138ba148cb2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bab52cec3fba6e57]::util::run_in_thread_pool_with_globals<rustc_interface[bab52cec3fba6e57]::interface::run_compiler<core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>, rustc_driver[f93b8a3886cc8b65]::run_compiler::{closure#1}>::{closure#0}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>
  45:        0x1170f3b4b - <<std[38dd6138ba148cb2]::thread::Builder>::spawn_unchecked_<rustc_interface[bab52cec3fba6e57]::util::run_in_thread_pool_with_globals<rustc_interface[bab52cec3fba6e57]::interface::run_compiler<core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>, rustc_driver[f93b8a3886cc8b65]::run_compiler::{closure#1}>::{closure#0}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[322641b34a183a]::result::Result<(), rustc_errors[ef89fc2f19a46f90]::ErrorGuaranteed>>::{closure#1} as core[322641b34a183a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:        0x10e4e2967 - std::sys::unix::thread::Thread::new::thread_start::hae9a83a2ac729f3b
  47:     0x7ff806914259 - __pthread_start

error: internal compiler error: unexpected panic

note: 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.67.0-nightly (e75aab045 2022-11-09) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `for<'a, 'b, 'c, 'd, 'e, 'f> {core::future::ResumeTy, &'a mut (dyn rbdc::db::Connection + 'b), &'c mut alloc::boxed::Box<(dyn rbdc::db::Connection + 'd)>, &'e str, alloc::vec::Vec<rbs::value::Value>, core::pin::Pin<alloc::boxed::Box<(dyn core::future::future::Future<Output = core::result::Result<rbdc::db::ExecResult, rbdc::error::Error>> + core::marker::Send + 'f)>>, ()}: core::marker::Send`
#1 [typeck] type-checking `sql::tx::<impl at src/sql/tx.rs:13:1: 13:32>::commit`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate

```

</p>
</details>