Repository: rust
Issue: rustc panicked while introducing a base trait
Labels: I-ICE,T-compiler,A-incr-comp,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

I don't have a minimal repro, but I do have a relatively small diff of the change that triggered the problem. I am hiding it behind a "Details" section, like the backtrace, to keep the overview of the bug report short.

What I am doing, essentially, is adding a new trait to act as the supertrait of other two traits, and moving one common function to it.

<details><summary><strong>Code diff</strong></summary>
<p>

```patch
diff --git a/data/src/db/mod.rs b/data/src/db/mod.rs
index 9d67e43..fab55b8 100644
--- a/data/src/db/mod.rs
+++ b/data/src/db/mod.rs
@@ -5,7 +5,7 @@
 
 use crate::geo::CountryIsoCode;
 use crate::model::*;
-use rest_utils::db::{DbError, DbResult};
+use rest_utils::db::{BareTx, DbError, DbResult};
 use std::collections::BTreeMap;
 use uuid::Uuid;
 #[cfg(test)]
@@ -25,10 +25,7 @@ impl From<ModelError> for DbError {
 
 /// A transaction with high-level operations that deal with our types.
 #[async_trait::async_trait]
-pub(crate) trait DataTx {
-    /// Commits the transaction.  The transaction is rolled back on drop unless this is called.
-    async fn commit(self) -> DbResult<()>;
-
+pub(crate) trait DataTx: BareTx {
     /// Gets a `Site` based on its `site_id`.
     async fn get_site(&mut self, site_id: Uuid) -> DbResult<Site>;
 
diff --git a/data/src/db/pgsql.rs b/data/src/db/pgsql.rs
index 0e24aff..1f9566b 100644
--- a/data/src/db/pgsql.rs
+++ b/data/src/db/pgsql.rs
@@ -7,6 +7,7 @@ use crate::db::{count_as_usize, parse_country_iso_code, parse_url, DataTx, DbErr
 use crate::geo::CountryIsoCode;
 use crate::model::*;
 use futures::TryStreamExt;
+use rest_utils::db::BareTx;
 use sqlx::postgres::PgDatabaseError;
 use sqlx::{Postgres, Row, Transaction};
 use std::collections::BTreeMap;
@@ -56,11 +57,14 @@ impl From<Transaction<'static, Postgres>> for PostgresDataTx {
 }
 
 #[async_trait::async_trait]
-impl DataTx for PostgresDataTx {
+impl BareTx for PostgresDataTx {
     async fn commit(mut self) -> DbResult<()> {
         self.tx.commit().await.map_err(map_sqlx_error)
     }
+}
 
+#[async_trait::async_trait]
+impl DataTx for PostgresDataTx {
     async fn get_site(&mut self, site_id: Uuid) -> DbResult<Site> {
         let query_str = "SELECT title, email FROM sites WHERE site_id = $1";
         let row = sqlx::query(query_str)
diff --git a/data/src/db/sqlite.rs b/data/src/db/sqlite.rs
index 7edc250..f571266 100644
--- a/data/src/db/sqlite.rs
+++ b/data/src/db/sqlite.rs
@@ -9,6 +9,7 @@ use crate::model::*;
 use futures::lock::Mutex;
 use futures::TryStreamExt;
 use rest_utils::db::sqlite::map_sqlx_error;
+use rest_utils::db::BareTx;
 use sqlx::{Row, Sqlite, Transaction};
 use std::collections::BTreeMap;
 use std::convert::{TryFrom, TryInto};
@@ -95,12 +96,15 @@ impl From<Mutex<Transaction<'static, Sqlite>>> for SqliteDataTx {
 }
 
 #[async_trait::async_trait]
-impl DataTx for SqliteDataTx {
-    async fn commit(self) -> DbResult<()> {
+impl BareTx for SqliteDataTx {
+    async fn commit(mut self) -> DbResult<()> {
         let tx = self.tx.into_inner();
         tx.commit().await.map_err(map_sqlx_error)
     }
+}
 
+#[async_trait::async_trait]
+impl DataTx for SqliteDataTx {
     async fn get_site(&mut self, site_id: Uuid) -> DbResult<Site> {
         let mut tx = self.tx.lock().await;
 
diff --git a/data/src/driver/batch.rs b/data/src/driver/batch.rs
index f8c5d8a..df618b1 100644
--- a/data/src/driver/batch.rs
+++ b/data/src/driver/batch.rs
@@ -8,7 +8,7 @@ use crate::abuse::AbusePolicy;
 use crate::db::DataTx;
 use crate::model::{Comment, HttpMethod, Request, VoteCounts, VoteId, VoteReaction};
 use log::warn;
-use rest_utils::db::{Db, DbError};
+use rest_utils::db::{BareTx, Db, DbError};
 use uuid::Uuid;
 
 /// Operations requested in batch for the page.
diff --git a/data/src/driver/count_votes.rs b/data/src/driver/count_votes.rs
index d061f06..dbc9922 100644
--- a/data/src/driver/count_votes.rs
+++ b/data/src/driver/count_votes.rs
@@ -9,7 +9,7 @@ use crate::{
     db::DataTx,
     model::{VoteCounts, VoteId, VoteReaction},
 };
-use rest_utils::db::{Db, DbError};
+use rest_utils::db::{BareTx, Db, DbError};
 use url::Url;
 use uuid::Uuid;
 
diff --git a/data/src/driver/delete_vote.rs b/data/src/driver/delete_vote.rs
index 992ea16..2bf3089 100644
--- a/data/src/driver/delete_vote.rs
+++ b/data/src/driver/delete_vote.rs
@@ -5,7 +5,7 @@
 
 use super::{ensure_path_in_site, Driver, DriverResult};
 use crate::{abuse::AbusePolicy, db::DataTx, model::VoteId};
-use rest_utils::db::Db;
+use rest_utils::db::{BareTx, Db};
 
 impl<A, D> Driver<A, D>
 where
diff --git a/data/src/driver/get_comments.rs b/data/src/driver/get_comments.rs
index a56982b..6f96803 100644
--- a/data/src/driver/get_comments.rs
+++ b/data/src/driver/get_comments.rs
@@ -5,7 +5,7 @@
 
 use super::{ensure_path_in_site, Driver, DriverResult};
 use crate::{abuse::AbusePolicy, db::DataTx, model::Comment};
-use rest_utils::db::Db;
+use rest_utils::db::{BareTx, Db};
 use url::Url;
 use uuid::Uuid;
 
diff --git a/data/src/driver/put_comment.rs b/data/src/driver/put_comment.rs
index a7ebb77..2824344 100644
--- a/data/src/driver/put_comment.rs
+++ b/data/src/driver/put_comment.rs
@@ -5,7 +5,7 @@
 
 use super::{ensure_path_in_site, Driver, DriverResult};
 use crate::{abuse::AbusePolicy, db::DataTx, model::Comment};
-use rest_utils::db::Db;
+use rest_utils::db::{BareTx, Db};
 use uuid::Uuid;
 
 impl<A, D> Driver<A, D>
diff --git a/data/src/driver/put_request.rs b/data/src/driver/put_request.rs
index ff497d9..fddbb3f 100644
--- a/data/src/driver/put_request.rs
+++ b/data/src/driver/put_request.rs
@@ -6,7 +6,7 @@
 use super::{ensure_path_in_site, Driver, DriverResult};
 use crate::{abuse::AbusePolicy, db::DataTx, model::Request};
 use log::warn;
-use rest_utils::db::Db;
+use rest_utils::db::{BareTx, Db};
 use uuid::Uuid;
 
 /// Information computed when storing a request that may be useful to the client.
diff --git a/data/src/driver/put_vote.rs b/data/src/driver/put_vote.rs
index 1acbfc8..a816561 100644
--- a/data/src/driver/put_vote.rs
+++ b/data/src/driver/put_vote.rs
@@ -7,7 +7,7 @@ use super::{ensure_path_in_site, Driver, DriverResult};
 use crate::abuse::AbusePolicy;
 use crate::db::DataTx;
 use crate::model::{Vote, VoteId};
-use rest_utils::db::Db;
+use rest_utils::db::{BareTx, Db};
 
 impl<A, D> Driver<A, D>
 where
diff --git a/rest-utils/src/db/mod.rs b/rest-utils/src/db/mod.rs
index 420331a..61b0713 100644
--- a/rest-utils/src/db/mod.rs
+++ b/rest-utils/src/db/mod.rs
@@ -3,6 +3,8 @@
 
 //! Generic features and types to access a database.
 
+use async_trait::async_trait;
+
 #[cfg(feature = "postgres")]
 pub mod postgres;
 #[cfg(feature = "sqlite")]
@@ -38,15 +40,21 @@ pub enum DbError {
 pub type DbResult<T> = Result<T, DbError>;
 
 /// Abstraction over the database connection.
-#[async_trait::async_trait]
+#[async_trait]
 pub trait Db {
     /// Type of the wrapped sqlx transaction.
     type SqlxTx;
 
     /// Type of the transaction wrapper type to generate.
-    // DO NOT SUBMIT: Add BareTx.
-    type Tx: From<Self::SqlxTx> + Send + Sync + 'static;
+    type Tx: BareTx + From<Self::SqlxTx> + Send + Sync + 'static;
 
     /// Begins a transaction.
     async fn begin(&self) -> DbResult<Self::Tx>;
 }
+
+/// Common operations for all transactions.
+#[async_trait]
+pub trait BareTx {
+    /// Commits the transaction.
+    async fn commit(mut self) -> DbResult<()>;
+}
diff --git a/rest-utils/src/db/postgres.rs b/rest-utils/src/db/postgres.rs
index a887d1f..e2398f3 100644
--- a/rest-utils/src/db/postgres.rs
+++ b/rest-utils/src/db/postgres.rs
@@ -3,7 +3,7 @@
 
 //! Common utilities to interact with a PostgreSQL database.
 
-use crate::db::{Db, DbError, DbResult};
+use crate::db::{BareTx, Db, DbError, DbResult};
 use derivative::Derivative;
 use sqlx::postgres::{PgConnectOptions, PgDatabaseError, PgPool, PgPoolOptions, Postgres};
 use sqlx::Transaction;
@@ -96,7 +96,7 @@ impl PostgresOptions {
 #[derivative(Clone(bound = ""))]
 pub struct PostgresDb<T>
 where
-    T: From<Transaction<'static, Postgres>> + Send + Sync + 'static,
+    T: BareTx + From<Transaction<'static, Postgres>> + Send + Sync + 'static,
 {
     /// Shared PostgreSQL connection pool.  This is a cloneable type that all concurrent
     /// transactions can use it concurrently.
@@ -108,7 +108,7 @@ where
 
 impl<T> PostgresDb<T>
 where
-    T: From<Transaction<'static, Postgres>> + Send + Sync + 'static,
+    T: BareTx + From<Transaction<'static, Postgres>> + Send + Sync + 'static,
 {
     /// Creates a new connection with a set of pool options.
     fn connect_lazy_with_pool_options(opts: PostgresOptions, pool_options: PgPoolOptions) -> Self {
@@ -173,7 +173,7 @@ where
 
 impl<T> Drop for PostgresDb<T>
 where
-    T: From<Transaction<'static, Postgres>> + Send + Sync + 'static,
+    T: BareTx + From<Transaction<'static, Postgres>> + Send + Sync + 'static,
 {
     #[allow(unused_must_use)]
     fn drop(&mut self) {
@@ -190,7 +190,7 @@ where
 #[async_trait::async_trait]
 impl<T> Db for PostgresDb<T>
 where
-    T: From<Transaction<'static, Postgres>> + Send + Sync + 'static,
+    T: BareTx + From<Transaction<'static, Postgres>> + Send + Sync + 'static,
 {
     type SqlxTx = Transaction<'static, Postgres>;
     type Tx = T;
@@ -209,7 +209,7 @@ pub mod testutils {
     /// Creates a new connection to the test database and initializes it.
     pub async fn setup<T>(schema: &str) -> PostgresDb<T>
     where
-        T: From<Transaction<'static, Postgres>> + Send + Sync + 'static,
+        T: BareTx + From<Transaction<'static, Postgres>> + Send + Sync + 'static,
     {
         let _can_fail = env_logger::builder().is_test(true).try_init();
 
diff --git a/rest-utils/src/db/sqlite.rs b/rest-utils/src/db/sqlite.rs
index 5e29399..afd5435 100644
--- a/rest-utils/src/db/sqlite.rs
+++ b/rest-utils/src/db/sqlite.rs
@@ -3,14 +3,13 @@
 
 //! Common utilities to interact with an SQLite database.
 
-use std::marker::PhantomData;
-
-use crate::db::{Db, DbError, DbResult};
+use crate::db::{BareTx, Db, DbError, DbResult};
 use derivative::Derivative;
 use futures::lock::Mutex;
 use futures::TryStreamExt;
 use sqlx::sqlite::{Sqlite, SqlitePool};
 use sqlx::Transaction;
+use std::marker::PhantomData;
 
 /// Takes a raw SQLx error `e` and converts it to our generic error type.
 pub fn map_sqlx_error(e: sqlx::Error) -> DbError {
@@ -28,7 +27,7 @@ pub fn map_sqlx_error(e: sqlx::Error) -> DbError {
 #[derivative(Clone(bound = ""))]
 pub struct SqliteDb<T>
 where
-    T: From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
+    T: BareTx + From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
 {
     /// Shared SQLite connection pool.  This is a cloneable type that all concurrent
     /// transactions can use it concurrently.
@@ -40,7 +39,7 @@ where
 
 impl<T> SqliteDb<T>
 where
-    T: From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
+    T: BareTx + From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
 {
     /// Creates a new connection and sets the database schema.
     pub async fn connect(schema: &str) -> DbResult<Self> {
@@ -62,7 +61,7 @@ where
 #[async_trait::async_trait]
 impl<T> Db for SqliteDb<T>
 where
-    T: From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
+    T: BareTx + From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
 {
     type SqlxTx = Mutex<Transaction<'static, Sqlite>>;
     type Tx = T;
@@ -81,7 +80,7 @@ pub mod testutils {
     /// Initializes the test database with a schema.
     pub async fn setup<T>(schema: &str) -> SqliteDb<T>
     where
-        T: From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
+        T: BareTx + From<Mutex<Transaction<'static, Sqlite>>> + Send + Sync + 'static,
     {
         let _can_fail = env_logger::builder().is_test(true).try_init();
 ```

</p>
</details>

### 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`:
```
note: rustc 1.67.1 (d5a82bbd2 2023-02-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/bin/mold
```

### 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: [Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as std::convert::From<<D as rest_utils::db::Db>::SqlxTx>>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as db::DataTx>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as rest_utils::db::BareTx>, polarity:Positive), []), Binder(TraitPredicate(<D as rest_utils::db::Db>, polarity:Positive), []), Binder(TraitPredicate(<D as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: [async fn body@data/src/db/testutils.rs:214:1: 283:2] } } }
- dep-node: type_op_normalize_ty(85797b8fca3b0266-a115299a28e80846)', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/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>

```
   Compiling service-data v0.0.0 (/home/jmmv/os/service/data)
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as std::convert::From<<D as rest_utils::db::Db>::SqlxTx>>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as db::DataTx>, polarity:Positive), []), Binder(TraitPredicate(<<D as rest_utils::db::Db>::Tx as rest_utils::db::BareTx>, polarity:Positive), []), Binder(TraitPredicate(<D as rest_utils::db::Db>, polarity:Positive), []), Binder(TraitPredicate(<D as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: [async fn body@data/src/db/testutils.rs:214:1: 283:2] } } }
- dep-node: type_op_normalize_ty(85797b8fca3b0266-a115299a28e80846)', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/compiler/rustc_query_system/src/dep_graph/graph.rs:316:9
stack backtrace:
   0:     0x7f27979656fa - std::backtrace_rs::backtrace::libunwind::trace::h79937bc171ada62c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f27979656fa - std::backtrace_rs::backtrace::trace_unsynchronized::h2292bca8571cb919
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f27979656fa - std::sys_common::backtrace::_print_fmt::h9c461f248e4ae90d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f27979656fa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he9fe6bf1a39182e1
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f27979c825e - core::fmt::write::h032658c119c720d7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f2797955a85 - std::io::Write::write_fmt::h299fc90dfae41c0d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/io/mod.rs:1682:15
   6:     0x7f27979654c5 - std::sys_common::backtrace::_print::heb70d25df9937e3f
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f27979654c5 - std::sys_common::backtrace::print::had745c0a76b8b521
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f279796820f - std::panicking::default_hook::{{closure}}::h1ea782cdfa2fd097
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:267:22
   9:     0x7f2797967f4b - std::panicking::default_hook::h1cc3af63455a163c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:286:9
  10:     0x7f279ac60ab1 - <rustc_driver[5c3b90d1fb3964ba]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[e6a29f2585b3d454]::ops::function::FnOnce<(&core[e6a29f2585b3d454]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f2797968a4d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6e4950ba7c0fd82a
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2032:9
  12:     0x7f2797968a4d - std::panicking::rust_panic_with_hook::h5cafdc4b3bfd5528
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:692:13
  13:     0x7f27979687c9 - std::panicking::begin_panic_handler::{{closure}}::hf31c60f40775892c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:579:13
  14:     0x7f2797965bac - std::sys_common::backtrace::__rust_end_short_backtrace::h28a5c7be595826cd
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7f27979684d2 - rust_begin_unwind
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
  16:     0x7f27979c4c43 - core::panicking::panic_fmt::h8fa27a0b37dd98b7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
  17:     0x7f2799f7f2e0 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_middle[83f907612b22699d]::infer::canonical::Canonical<rustc_middle[83f907612b22699d]::ty::ParamEnvAnd<rustc_middle[83f907612b22699d]::traits::query::type_op::Normalize<rustc_middle[83f907612b22699d]::ty::Ty>>>, core[e6a29f2585b3d454]::result::Result<&rustc_middle[83f907612b22699d]::infer::canonical::Canonical<rustc_middle[83f907612b22699d]::infer::canonical::QueryResponse<rustc_middle[83f907612b22699d]::ty::Ty>>, rustc_middle[83f907612b22699d]::traits::query::NoSolution>>
  18:     0x7f2799f7d7e9 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::DefaultCache<rustc_middle[83f907612b22699d]::infer::canonical::Canonical<rustc_middle[83f907612b22699d]::ty::ParamEnvAnd<rustc_middle[83f907612b22699d]::traits::query::type_op::Normalize<rustc_middle[83f907612b22699d]::ty::Ty>>>, core[e6a29f2585b3d454]::result::Result<&rustc_middle[83f907612b22699d]::infer::canonical::Canonical<rustc_middle[83f907612b22699d]::infer::canonical::QueryResponse<rustc_middle[83f907612b22699d]::ty::Ty>>, rustc_middle[83f907612b22699d]::traits::query::NoSolution>>>
  19:     0x7f2799f7cf5d - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::type_op_normalize_ty, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  20:     0x7f2799f7cea3 - <rustc_query_impl[e214cefb6de2a99d]::Queries as rustc_middle[83f907612b22699d]::ty::query::QueryEngine>::type_op_normalize_ty
  21:     0x7f2799ac6dce - <rustc_middle[83f907612b22699d]::ty::ParamEnvAnd<rustc_middle[83f907612b22699d]::traits::query::type_op::Normalize<rustc_middle[83f907612b22699d]::ty::Ty>> as rustc_trait_selection[945b70100f8dd3ec]::traits::query::type_op::TypeOp>::fully_perform
  22:     0x7f2799a8c1a6 - <&mut <rustc_borrowck[323b14a08f10fded]::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create::{closure#0} as core[e6a29f2585b3d454]::ops::function::FnOnce<(rustc_middle[83f907612b22699d]::ty::Ty,)>>::call_once
  23:     0x7f2799a8ba92 - <alloc[89959c1738bdde42]::vec::Vec<&rustc_middle[83f907612b22699d]::infer::canonical::QueryRegionConstraints> as alloc[89959c1738bdde42]::vec::spec_from_iter::SpecFromIter<&rustc_middle[83f907612b22699d]::infer::canonical::QueryRegionConstraints, core[e6a29f2585b3d454]::iter::adapters::flatten::FlatMap<core[e6a29f2585b3d454]::iter::adapters::chain::Chain<core[e6a29f2585b3d454]::iter::adapters::cloned::Cloned<core[e6a29f2585b3d454]::slice::iter::Iter<rustc_middle[83f907612b22699d]::ty::Ty>>, core[e6a29f2585b3d454]::option::IntoIter<rustc_middle[83f907612b22699d]::ty::Ty>>, core[e6a29f2585b3d454]::iter::adapters::chain::Chain<core[e6a29f2585b3d454]::iter::adapters::chain::Chain<core[e6a29f2585b3d454]::option::IntoIter<&rustc_middle[83f907612b22699d]::infer::canonical::QueryRegionConstraints>, core[e6a29f2585b3d454]::option::IntoIter<&rustc_middle[83f907612b22699d]::infer::canonical::QueryRegionConstraints>>, core[e6a29f2585b3d454]::option::IntoIter<&rustc_middle[83f907612b22699d]::infer::canonical::QueryRegionConstraints>>, <rustc_borrowck[323b14a08f10fded]::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create::{closure#0}>>>::from_iter
  24:     0x7f2799a86b29 - rustc_borrowck[323b14a08f10fded]::type_check::free_region_relations::create
  25:     0x7f2799a7b248 - rustc_borrowck[323b14a08f10fded]::type_check::type_check
  26:     0x7f2799a52165 - rustc_borrowck[323b14a08f10fded]::nll::compute_regions
  27:     0x7f2799a2fdcb - rustc_borrowck[323b14a08f10fded]::do_mir_borrowck
  28:     0x7f2799a2bbf9 - rustc_borrowck[323b14a08f10fded]::mir_borrowck
  29:     0x7f2799a2b0d5 - <rustc_borrowck[323b14a08f10fded]::provide::{closure#0} as core[e6a29f2585b3d454]::ops::function::FnOnce<(rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::def_id::LocalDefId)>>::call_once
  30:     0x7f2799d222ac - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, &rustc_middle[83f907612b22699d]::mir::query::BorrowCheckResult>
  31:     0x7f2799d20fbc - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::VecCache<rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, &rustc_middle[83f907612b22699d]::mir::query::BorrowCheckResult>>
  32:     0x7f279a60640a - <rustc_query_impl[e214cefb6de2a99d]::Queries as rustc_middle[83f907612b22699d]::ty::query::QueryEngine>::mir_borrowck
  33:     0x7f2799b1b811 - <rustc_borrowck[323b14a08f10fded]::type_check::TypeChecker>::prove_closure_bounds
  34:     0x7f2799af6a26 - <rustc_borrowck[323b14a08f10fded]::type_check::TypeChecker>::typeck_mir
  35:     0x7f2799a7b5c3 - rustc_borrowck[323b14a08f10fded]::type_check::type_check
  36:     0x7f2799a52165 - rustc_borrowck[323b14a08f10fded]::nll::compute_regions
  37:     0x7f2799a2fdcb - rustc_borrowck[323b14a08f10fded]::do_mir_borrowck
  38:     0x7f2799a2bbf9 - rustc_borrowck[323b14a08f10fded]::mir_borrowck
  39:     0x7f2799a2b0d5 - <rustc_borrowck[323b14a08f10fded]::provide::{closure#0} as core[e6a29f2585b3d454]::ops::function::FnOnce<(rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::def_id::LocalDefId)>>::call_once
  40:     0x7f2799d222ac - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, &rustc_middle[83f907612b22699d]::mir::query::BorrowCheckResult>
  41:     0x7f2799d20fbc - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::VecCache<rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, &rustc_middle[83f907612b22699d]::mir::query::BorrowCheckResult>>
  42:     0x7f279b41bab6 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::force_query::<rustc_query_impl[e214cefb6de2a99d]::queries::mir_borrowck, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  43:     0x7f279b5901d1 - rustc_query_impl[e214cefb6de2a99d]::plumbing::force_from_dep_node::<rustc_query_impl[e214cefb6de2a99d]::queries::mir_borrowck>
  44:     0x7f2798cbb039 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  45:     0x7f2799587bf9 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::type_of, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  46:     0x7f27996484bc - rustc_hir_analysis[44326659f1d3f01d]::check::check::check_mod_item_types
  47:     0x7f279980877c - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, ()>
  48:     0x7f279980668e - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::VecCache<rustc_span[41a321a6411ba4fa]::def_id::LocalDefId, ()>>
  49:     0x7f279a002a83 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::check_mod_item_types, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  50:     0x7f279a2db4c5 - <rustc_middle[83f907612b22699d]::hir::map::Map>::for_each_module::<rustc_hir_analysis[44326659f1d3f01d]::check_crate::{closure#6}::{closure#0}>
  51:     0x7f279915ad42 - rustc_hir_analysis[44326659f1d3f01d]::check_crate
  52:     0x7f279915a98b - rustc_interface[65dcc5dffb099e04]::passes::analysis
  53:     0x7f279a41291f - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, (), core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  54:     0x7f279a411a17 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::DefaultCache<(), core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>>
  55:     0x7f279a411470 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::analysis, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  56:     0x7f2799e241b3 - <rustc_interface[65dcc5dffb099e04]::passes::QueryContext>::enter::<rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  57:     0x7f2799e20733 - <rustc_interface[65dcc5dffb099e04]::interface::Compiler>::enter::<rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}::{closure#2}, core[e6a29f2585b3d454]::result::Result<core[e6a29f2585b3d454]::option::Option<rustc_interface[65dcc5dffb099e04]::queries::Linker>, rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  58:     0x7f2799e1b788 - rustc_span[41a321a6411ba4fa]::with_source_map::<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  59:     0x7f2799e1b275 - <scoped_tls[393dd8f8fd825c8d]::ScopedKey<rustc_span[41a321a6411ba4fa]::SessionGlobals>>::set::<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  60:     0x7f2799e1a862 - std[359ab902947f5f0b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[65dcc5dffb099e04]::util::run_in_thread_pool_with_globals<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  61:     0x7f279a513b7a - <<std[359ab902947f5f0b]::thread::Builder>::spawn_unchecked_<rustc_interface[65dcc5dffb099e04]::util::run_in_thread_pool_with_globals<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#1} as core[e6a29f2585b3d454]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  62:     0x7f2797972803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb77d8d72ebcf79c4
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  63:     0x7f2797972803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc08c3353e1568487
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  64:     0x7f2797972803 - std::sys::unix::thread::Thread::new::thread_start::h7168e596cd5e5ce6
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys/unix/thread.rs:108:17
  65:     0x7f2797706fd4 - <unknown>
  66:     0x7f279778766c - <unknown>
  67:                0x0 - <unknown>

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.1 (d5a82bbd2 2023-02-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/bin/mold

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_op_normalize_ty] normalizing `[async fn body@data/src/db/testutils.rs:214:1: 283:2]`
#1 [mir_borrowck] borrow-checking `db::testutils::test_count_requests_for_page::{closure#0}`
#2 [mir_borrowck] borrow-checking `db::testutils::test_count_requests_for_page`
#3 [type_of] computing type of `db::testutils::test_count_requests_for_page::{opaque#0}`
#4 [check_mod_item_types] checking item types in module `db::testutils`
#5 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `service-data`
```

</p>
</details>