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

I encountered this error whilst running `cargo sqlx prepare` on a project. Unfortunately I haven't been able to come up with a minimal reproduction of the issue.

### Error output

```
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Canonical { value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(OutlivesPredicate(ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(None) }), ReLateBound(DebruijnIndex(1), BoundRegion { var: 1, kind: BrAnon(None) })), []), Binder(OutlivesPredicate(ReLateBound(DebruijnIndex(1), BoundRegion { var: 2, kind: BrAnon(None) }), ReLateBound(DebruijnIndex(1), BoundRegion { var: 1, kind: BrAnon(None) })), []), Binder(TraitPredicate(<aerosol::Aero<aerosol::frunk::HCons<platformed_types::config::Environment, aerosol::frunk::HCons<sqlx::Pool<sqlx::Postgres>, aerosol::frunk::HCons<cookie::Key, aerosol::frunk::HCons<platformed_types::config::FrontendEnvironment, aerosol::frunk::HCons<notifications::NotificationsService, aerosol::frunk::HCons<postmark::reqwest::PostmarkClient, aerosol::frunk::HCons<external_authorization_providers::ExternalAuthorizationProviders, aerosol::frunk::HCons<document_source_connectors::DocumentSourceConnectors, aerosol::frunk::HCons<pusher::Pusher, aerosol::frunk::HNil>>>>>>>>>> as axum::extract::FromRef<S>>, polarity:Positive), []), Binder(TraitPredicate(<S as std::marker::Sync>, polarity:Positive), []), Binder(TraitPredicate(<S as std::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<S as std::marker::Sized>, polarity:Positive), []), Binder(OutlivesPredicate(auth::ApikeyAuthenticated, ReLateBound(DebruijnIndex(1), BoundRegion { var: 1, kind: BrAnon(None) })), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: [async block@backend\src\auth.rs:108:5: 108:94] } }, max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }
- dep-node: type_op_normalize_ty(3f856ee2f7938966-e522e4d857ad443e)', /rustc/90c541806f23a127002de5b4038be731ba1458ca\compiler\rustc_query_system\src\dep_graph\graph.rs:350:9
stack backtrace:
   0:     0x7ffa33a96c02 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he4dbe7f5385cd1e2
   1:     0x7ffa33ad4f5b - core::fmt::write::h72b30843329f2c20
   2:     0x7ffa33a8be6a - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h44d7f217ec8c08a4
   3:     0x7ffa33a9694b - std::sys::common::alloc::realloc_fallback::h25dd000eefb1a25f
   4:     0x7ffa33a9a2da - std::panicking::default_hook::h8d2d551f7739f430
   5:     0x7ffa33a99f40 - std::panicking::default_hook::h8d2d551f7739f430
   6:     0x7ff9fbd5f02e - rustc_driver_impl[39e757d53880b308]::describe_lints
   7:     0x7ffa33a9abef - std::panicking::rust_panic_with_hook::h2561aa68cd5abc10
   8:     0x7ffa33a9a94e - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hcac4dd4b6ea7d20c
   9:     0x7ffa33a978a9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he4dbe7f5385cd1e2
  10:     0x7ffa33a9a660 - rust_begin_unwind
  11:     0x7ffa33b09165 - core::panicking::panic_fmt::he37b281957295da9
  12:     0x7ff9fa0915c5 - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  13:     0x7ff9fa13ed72 - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  14:     0x7ff9f9fe5c84 - <rustc_query_impl[31ecb434a2a03a44]::Queries as rustc_middle[298b6ec0f969779]::ty::query::QueryEngine>::try_mark_green
  15:     0x7ff9fbb64783 - <rustc_middle[298b6ec0f969779]::ty::Ty as rustc_trait_selection[25b1749834e540b2]::traits::query::type_op::normalize::Normalizable>::type_op_method
  16:     0x7ff9fb5286dc - <rustc_middle[298b6ec0f969779]::mir::Location as rustc_borrowck[1cd546338639e988]::type_check::NormalizeLocation>::to_locations
  17:     0x7ff9fb4b5572 - <polonius_engine[e76070452d0682db]::facts::AllFacts<rustc_borrowck[1cd546338639e988]::facts::RustcFacts> as rustc_borrowck[1cd546338639e988]::facts::AllFactsExt>::enabled
  18:     0x7ff9fb421276 - <rustc_borrowck[1cd546338639e988]::MirBorrowckCtxt as rustc_mir_dataflow[8d163a54c6877a60]::framework::visitor::ResultsVisitor>::visit_terminator_before_primary_effect
  19:     0x7ff9fb4156b4 - <rustc_middle[298b6ec0f969779]::ty::adjustment::AutoBorrowMutability as rustc_mir_build[692303aa0e857e66]::thir::cx::expr::ToBorrowKind>::to_borrow_kind
  20:     0x7ff9fa02b603 - <&rustc_data_structures[41be42171f3b2d17]::unord::UnordSet<rustc_span[ad67946381e6ba24]::def_id::LocalDefId> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  21:     0x7ff9fa04ba5c - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  22:     0x7ff9fb77f4c7 - <&[rustc_type_ir[e4a94c75124a4b3a]::Variance] as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  23:     0x7ff9fb6b9d20 - <rustc_query_impl[31ecb434a2a03a44]::Queries as rustc_middle[298b6ec0f969779]::ty::query::QueryEngine>::as_any
  24:     0x7ff9f9f45cbc - <rustc_borrowck[1cd546338639e988]::type_check::TypeVerifier as rustc_middle[298b6ec0f969779]::mir::visit::Visitor>::visit_span
  25:     0x7ff9fb4e3314 - <rustc_borrowck[1cd546338639e988]::type_check::TypeVerifier as rustc_middle[298b6ec0f969779]::mir::visit::Visitor>::visit_body
  26:     0x7ff9fb4b5a29 - <polonius_engine[e76070452d0682db]::facts::AllFacts<rustc_borrowck[1cd546338639e988]::facts::RustcFacts> as rustc_borrowck[1cd546338639e988]::facts::AllFactsExt>::enabled
  27:     0x7ff9fb421276 - <rustc_borrowck[1cd546338639e988]::MirBorrowckCtxt as rustc_mir_dataflow[8d163a54c6877a60]::framework::visitor::ResultsVisitor>::visit_terminator_before_primary_effect
  28:     0x7ff9fb4156b4 - <rustc_middle[298b6ec0f969779]::ty::adjustment::AutoBorrowMutability as rustc_mir_build[692303aa0e857e66]::thir::cx::expr::ToBorrowKind>::to_borrow_kind
  29:     0x7ff9fa02b603 - <&rustc_data_structures[41be42171f3b2d17]::unord::UnordSet<rustc_span[ad67946381e6ba24]::def_id::LocalDefId> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  30:     0x7ff9fa04ba5c - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  31:     0x7ff9fb77f4c7 - <&[rustc_type_ir[e4a94c75124a4b3a]::Variance] as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  32:     0x7ff9fb6b9d20 - <rustc_query_impl[31ecb434a2a03a44]::Queries as rustc_middle[298b6ec0f969779]::ty::query::QueryEngine>::as_any
  33:     0x7ff9fa4e6e7a - once_cell[b880d516fb8c3c0e]::imp::initialize_or_wait
  34:     0x7ff9f95ee52d - rustc_interface[2aa0624475714241]::callbacks::setup_callbacks
  35:     0x7ff9f95dacf5 - rustc_interface[2aa0624475714241]::passes::analysis
  36:     0x7ff9fa0e03c1 - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  37:     0x7ff9fa02c13c - <&rustc_data_structures[41be42171f3b2d17]::unord::UnordSet<rustc_span[ad67946381e6ba24]::def_id::LocalDefId> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  38:     0x7ff9fa0cafc5 - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  39:     0x7ff9fa173de8 - <&rustc_index[16c4f1290dbf3aed]::vec::IndexVec<rustc_middle[298b6ec0f969779]::mir::Promoted, rustc_middle[298b6ec0f969779]::mir::Body> as rustc_serialize[a924d7a59c3ae2b4]::serialize::Decodable<rustc_query_impl[31ecb434a2a03a44]::on_disk_cache::CacheDecoder>>::decode
  40:     0x7ff9f9fd7225 - <rustc_query_impl[31ecb434a2a03a44]::Queries as rustc_middle[298b6ec0f969779]::ty::query::QueryEngine>::try_mark_green
  41:     0x7ff9f9587f31 - rustc_driver_impl[39e757d53880b308]::main
  42:     0x7ff9f9595873 - <rustc_middle[298b6ec0f969779]::ty::SymbolName as core[bcfc2130cb4e43e7]::fmt::Display>::fmt
  43:     0x7ff9f959372d - rustc_driver_impl[39e757d53880b308]::args::arg_expand_all
  44:     0x7ff9f95889d0 - rustc_driver_impl[39e757d53880b308]::main
  45:     0x7ff9f9594d43 - rustc_driver_impl[39e757d53880b308]::args::arg_expand_all
  46:     0x7ffa33aacaac - std::sys::windows::thread::Thread::new::h911abb68de5d2aa0
  47:     0x7ffae5247614 - BaseThreadInitThunk
  48:     0x7ffae6b226b1 - RtlUserThreadStart

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.70.0 (90c541806 2023-05-31) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_op_normalize_ty] normalizing `[async block@backend\src\auth.rs:108:5: 108:94]`
#1 [mir_borrowck] borrow-checking `auth::<impl at backend\src\auth.rs:101:1: 101:52>::from_request_parts::{closure#0}`
#2 [mir_borrowck] borrow-checking `auth::<impl at backend\src\auth.rs:101:1: 101:52>::from_request_parts`
#3 [analysis] running analysis passes on this crate
end of query stack
```