Repository: rust
Issue: Strange Compiler Bug
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/
-->

I am very sorry, but I cannot seem to reproduce the bug easily.

Using the [Diesel ORM](https://diesel.rs/)  and the [diesel-derive-enum](https://github.com/adwhit/diesel-derive-enum) crate, I was able to make the compiler panic which was certainly unexpected to say the least, to fix the issue I did the sensible thing and ran `cargo clean` and redid the migrations (`diesel migrations redo --all`) to make sure the database was in a sane state, that seemed to fix the issue so I cannot get the backtrace. Something interesting to note was that before cleaning out the `target` directory and restoring the database, I tried compiling with the `release` profile for the first time and that worked, too. 

Everything seemed to work before adding the [diesel-derive-enum](https://github.com/adwhit/diesel-derive-enum) crate.

### Code

```sql
CREATE TYPE access_level AS ENUM (
    'a', 
    'b',
    'c',
    'd'
);

CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    
    -- Other fields omitted...
    
    access_level access_level NOT NULL
);
```

```rust
use diesel::prelude::*;

use crate::db::schema::users;

#[derive(Debug, diesel_derive_enum::DbEnum)]
#[ExistingTypePath = "crate::db::schema::sql_types::AccessLevel"]
pub enum AccessLevel {
    A,
    B,
    C,
    D,
}

#[derive(Debug, Queryable, Selectable, Identifiable)]
#[diesel(table_name = users)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct User {
    pub id: i32,
    
    // Other fields omitted...
    
    pub access_level: AccessLevel,
}
```


### 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.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2
```

### Error output

`cargo build`
```
   Compiling api v0.1.0 (/home/bastian/Projects/ULPN/backend/api)
thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/dep_node.rs:198:17:
Failed to extract DefId: def_kind 811f230faec2c667-a3abd75b66f4a7ff
stack backtrace:
   0:     0x76480cacb892 - std::backtrace_rs::backtrace::libunwind::trace::he4ee80166a02c846
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x76480cacb892 - std::backtrace_rs::backtrace::trace_unsynchronized::h476faccf57e88641
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x76480cacb892 - std::sys_common::backtrace::_print_fmt::h430c922a77e7a59c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x76480cacb892 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x76480cb1ca6c - core::fmt::rt::Argument::fmt::hf3df69369399bfa9
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
   5:     0x76480cb1ca6c - core::fmt::write::hd9a8d7d029f9ea1a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
   6:     0x76480cac078f - std::io::Write::write_fmt::h0e1226b2b8d973fe
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
   7:     0x76480cacb664 - std::sys_common::backtrace::_print::hd2df4a083f6e69b8
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x76480cacb664 - std::sys_common::backtrace::print::he907f6ad7eee41cb
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x76480cace35b - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
  10:     0x76480cace0b3 - std::panicking::default_hook::h25ba2457dea68e65
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:292:9
  11:     0x76480982845d - std[e4dfbc2c3f4b09f1]::panicking::update_hook::<alloc[1adba907b9db1888]::boxed::Box<rustc_driver_impl[24a943716c49befe]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x76480caceac0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h022ca2c0d8c21c9e
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
  13:     0x76480caceac0 - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
  14:     0x76480cace802 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
  15:     0x76480cacbd66 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x76480cace534 - rust_begin_unwind
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
  17:     0x76480cb18f85 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
  18:     0x764809cb8132 - <rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode as rustc_middle[fda44fdb505d3e7f]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  19:     0x76480aaf7a8d - <rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode as rustc_middle[fda44fdb505d3e7f]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  20:     0x764809fce7aa - <rustc_query_impl[e4152ad88c3d6c78]::plumbing::query_callback<rustc_query_impl[e4152ad88c3d6c78]::query_impl::def_kind::QueryType>::{closure#0} as core[836963c7c1decc11]::ops::function::FnOnce<(rustc_middle[fda44fdb505d3e7f]::ty::context::TyCtxt, rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode)>>::call_once
  21:     0x76480aa29055 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  22:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  23:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  24:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  25:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  26:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  27:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  28:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  29:     0x76480b0c81e2 - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::DefaultCache<rustc_type_ir[6f721bd5614e1944]::canonical::Canonical<rustc_middle[fda44fdb505d3e7f]::ty::context::TyCtxt, rustc_middle[fda44fdb505d3e7f]::ty::ParamEnvAnd<rustc_middle[fda44fdb505d3e7f]::ty::predicate::Predicate>>, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  30:     0x76480b0c685e - rustc_query_impl[e4152ad88c3d6c78]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  31:     0x76480796acdd - <rustc_trait_selection[50b41c8253db3482]::traits::fulfill::FulfillProcessor as rustc_data_structures[1326c540ec0dd647]::obligation_forest::ObligationProcessor>::process_obligation
  32:     0x76480aa0d800 - <rustc_data_structures[1326c540ec0dd647]::obligation_forest::ObligationForest<rustc_trait_selection[50b41c8253db3482]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[50b41c8253db3482]::traits::fulfill::FulfillProcessor>
  33:     0x76480b0b4b25 - <rustc_trait_selection[50b41c8253db3482]::traits::engine::ObligationCtxt>::select_where_possible
  34:     0x76480b033d20 - rustc_hir_analysis[7e49c3c0c7bed18]::check::check::check_item_type
  35:     0x76480b0dc878 - rustc_hir_analysis[7e49c3c0c7bed18]::check::wfcheck::check_well_formed
  36:     0x76480b0db45d - rustc_query_impl[e4152ad88c3d6c78]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>
  37:     0x76480b0d53bd - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::VecCache<rustc_hir[33aca5c26ba91407]::hir_id::OwnerId, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  38:     0x76480b93bb95 - <rustc_query_impl[e4152ad88c3d6c78]::plumbing::query_callback<rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_well_formed::QueryType>::{closure#0} as core[836963c7c1decc11]::ops::function::FnOnce<(rustc_middle[fda44fdb505d3e7f]::ty::context::TyCtxt, rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode)>>::call_once
  39:     0x76480aa29055 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  40:     0x76480aa28680 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  41:     0x76480b30affa - rustc_query_system[475239fef39bf53f]::query::plumbing::ensure_must_run::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::DefaultCache<rustc_span[a4517f2b2e65298c]::def_id::LocalModDefId, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  42:     0x76480b30a96a - rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  43:     0x76480ab3b7e1 - rustc_hir_analysis[7e49c3c0c7bed18]::check_crate
  44:     0x76480b311ef2 - rustc_interface[ba2b6dc4c96cb491]::passes::analysis
  45:     0x76480b3118e5 - rustc_query_impl[e4152ad88c3d6c78]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e4152ad88c3d6c78]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>
  46:     0x76480b89d375 - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::SingleCache<rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  47:     0x76480b89cf9c - rustc_query_impl[e4152ad88c3d6c78]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  48:     0x76480b5fc814 - rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler::<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}
  49:     0x76480b93eb6e - std[e4dfbc2c3f4b09f1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ba2b6dc4c96cb491]::util::run_in_thread_with_globals<rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>
  50:     0x76480b93e9ca - <<std[e4dfbc2c3f4b09f1]::thread::Builder>::spawn_unchecked_<rustc_interface[ba2b6dc4c96cb491]::util::run_in_thread_with_globals<rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#1} as core[836963c7c1decc11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x76480cad8145 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19b9e642d37e7272
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  52:     0x76480cad8145 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97265befc434d3ae
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  53:     0x76480cad8145 - std::sys::pal::unix::thread::Thread::new::thread_start::h420dad5cf01a9f35
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108:17
  54:     0x7648068aa1cf - <unknown>
  55:     0x76480692b6ec - <unknown>
  56:                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.78.0 (9b00956e5 2024-04-29) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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 [evaluate_obligation] evaluating trait selection obligation `diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<db::schema::users::table>>: diesel::associations::HasTable`  |  = note: this failure-note originates in the macro `diesel::table` (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [check_well_formed] checking that `db::schema::users::<impl at api/src/db/schema.rs:54:1: 66:2>` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 representability(cece6b17da45e6a8-8eb3b1ae451f9421)
#1 adt_sized_constraint(thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/dep_node.rs:198:17:
Failed to extract DefId: adt_sized_constraint 811f230faec2c667-a3abd75b66f4a7ff
stack backtrace:
   0:     0x76480cacb892 - std::backtrace_rs::backtrace::libunwind::trace::he4ee80166a02c846
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x76480cacb892 - std::backtrace_rs::backtrace::trace_unsynchronized::h476faccf57e88641
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x76480cacb892 - std::sys_common::backtrace::_print_fmt::h430c922a77e7a59c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x76480cacb892 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x76480cb1ca6c - core::fmt::rt::Argument::fmt::hf3df69369399bfa9
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
   5:     0x76480cb1ca6c - core::fmt::write::hd9a8d7d029f9ea1a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
   6:     0x76480cac078f - std::io::Write::write_fmt::h0e1226b2b8d973fe
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
   7:     0x76480cacb664 - std::sys_common::backtrace::_print::hd2df4a083f6e69b8
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x76480cacb664 - std::sys_common::backtrace::print::he907f6ad7eee41cb
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x76480cace35b - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
  10:     0x76480cace0b3 - std::panicking::default_hook::h25ba2457dea68e65
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:292:9
  11:     0x76480982845d - std[e4dfbc2c3f4b09f1]::panicking::update_hook::<alloc[1adba907b9db1888]::boxed::Box<rustc_driver_impl[24a943716c49befe]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x76480caceac0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h022ca2c0d8c21c9e
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
  13:     0x76480caceac0 - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
  14:     0x76480cace802 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
  15:     0x76480cacbd66 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x76480cace534 - rust_begin_unwind
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
  17:     0x76480cb18f85 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
  18:     0x764809cb8132 - <rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode as rustc_middle[fda44fdb505d3e7f]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  19:     0x76480aaf7a8d - <rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode as rustc_middle[fda44fdb505d3e7f]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  20:     0x764809b53641 - rustc_interface[ba2b6dc4c96cb491]::callbacks::dep_node_debug
  21:     0x76480a03b0c7 - <rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode as core[836963c7c1decc11]::fmt::Debug>::fmt
  22:     0x76480cb1ca6c - core::fmt::rt::Argument::fmt::hf3df69369399bfa9
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
  23:     0x76480cb1ca6c - core::fmt::write::hd9a8d7d029f9ea1a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
  24:     0x76480cabe93b - std::io::Write::write_fmt::hb9ae79d0554438ee
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
  25:     0x76480cabe93b - <&std::io::stdio::Stderr as std::io::Write>::write_fmt::h9b72302c34553b01
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/stdio.rs:1008:9
  26:     0x76480cabf18a - <std::io::stdio::Stderr as std::io::Write>::write_fmt::h001307f201a39f70
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/stdio.rs:982:9
  27:     0x76480cabf18a - std::io::stdio::print_to::h9270ddabda4b6203
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/stdio.rs:1087:21
  28:     0x76480cabf18a - std::io::stdio::_eprint::hf581b85e5d5b46ce
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/stdio.rs:1175:5
  29:     0x764809f73013 - rustc_query_system[475239fef39bf53f]::dep_graph::graph::print_markframe_trace::<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>
  30:     0x76480aa29725 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  31:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  32:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  33:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  34:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  35:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  36:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  37:     0x76480aa28fbd - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  38:     0x76480b0c81e2 - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::DefaultCache<rustc_type_ir[6f721bd5614e1944]::canonical::Canonical<rustc_middle[fda44fdb505d3e7f]::ty::context::TyCtxt, rustc_middle[fda44fdb505d3e7f]::ty::ParamEnvAnd<rustc_middle[fda44fdb505d3e7f]::ty::predicate::Predicate>>, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  39:     0x76480b0c685e - rustc_query_impl[e4152ad88c3d6c78]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  40:     0x76480796acdd - <rustc_trait_selection[50b41c8253db3482]::traits::fulfill::FulfillProcessor as rustc_data_structures[1326c540ec0dd647]::obligation_forest::ObligationProcessor>::process_obligation
  41:     0x76480aa0d800 - <rustc_data_structures[1326c540ec0dd647]::obligation_forest::ObligationForest<rustc_trait_selection[50b41c8253db3482]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[50b41c8253db3482]::traits::fulfill::FulfillProcessor>
  42:     0x76480b0b4b25 - <rustc_trait_selection[50b41c8253db3482]::traits::engine::ObligationCtxt>::select_where_possible
  43:     0x76480b033d20 - rustc_hir_analysis[7e49c3c0c7bed18]::check::check::check_item_type
  44:     0x76480b0dc878 - rustc_hir_analysis[7e49c3c0c7bed18]::check::wfcheck::check_well_formed
  45:     0x76480b0db45d - rustc_query_impl[e4152ad88c3d6c78]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>
  46:     0x76480b0d53bd - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::VecCache<rustc_hir[33aca5c26ba91407]::hir_id::OwnerId, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  47:     0x76480b93bb95 - <rustc_query_impl[e4152ad88c3d6c78]::plumbing::query_callback<rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_well_formed::QueryType>::{closure#0} as core[836963c7c1decc11]::ops::function::FnOnce<(rustc_middle[fda44fdb505d3e7f]::ty::context::TyCtxt, rustc_query_system[475239fef39bf53f]::dep_graph::dep_node::DepNode)>>::call_once
  48:     0x76480aa29055 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  49:     0x76480aa28680 - <rustc_query_system[475239fef39bf53f]::dep_graph::graph::DepGraphData<rustc_middle[fda44fdb505d3e7f]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  50:     0x76480b30affa - rustc_query_system[475239fef39bf53f]::query::plumbing::ensure_must_run::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::DefaultCache<rustc_span[a4517f2b2e65298c]::def_id::LocalModDefId, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt>
  51:     0x76480b30a96a - rustc_query_impl[e4152ad88c3d6c78]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  52:     0x76480ab3b7e1 - rustc_hir_analysis[7e49c3c0c7bed18]::check_crate
  53:     0x76480b311ef2 - rustc_interface[ba2b6dc4c96cb491]::passes::analysis
  54:     0x76480b3118e5 - rustc_query_impl[e4152ad88c3d6c78]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e4152ad88c3d6c78]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>
  55:     0x76480b89d375 - rustc_query_system[475239fef39bf53f]::query::plumbing::try_execute_query::<rustc_query_impl[e4152ad88c3d6c78]::DynamicConfig<rustc_query_system[475239fef39bf53f]::query::caches::SingleCache<rustc_middle[fda44fdb505d3e7f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e4152ad88c3d6c78]::plumbing::QueryCtxt, true>
  56:     0x76480b89cf9c - rustc_query_impl[e4152ad88c3d6c78]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  57:     0x76480b5fc814 - rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler::<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}
  58:     0x76480b93eb6e - std[e4dfbc2c3f4b09f1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ba2b6dc4c96cb491]::util::run_in_thread_with_globals<rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>
  59:     0x76480b93e9ca - <<std[e4dfbc2c3f4b09f1]::thread::Builder>::spawn_unchecked_<rustc_interface[ba2b6dc4c96cb491]::util::run_in_thread_with_globals<rustc_interface[ba2b6dc4c96cb491]::interface::run_compiler<core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>, rustc_driver_impl[24a943716c49befe]::run_compiler::{closure#0}>::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[836963c7c1decc11]::result::Result<(), rustc_span[a4517f2b2e65298c]::ErrorGuaranteed>>::{closure#1} as core[836963c7c1decc11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  60:     0x76480cad8145 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19b9e642d37e7272
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  61:     0x76480cad8145 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97265befc434d3ae
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  62:     0x76480cad8145 - std::sys::pal::unix::thread::Thread::new::thread_start::h420dad5cf01a9f35
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108:17
  63:     0x7648068aa1cf - <unknown>
  64:     0x76480692b6ec - <unknown>
  65:                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.78.0 (9b00956e5 2024-04-29) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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 [evaluate_obligation] evaluating trait selection obligation `diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<db::schema::users::table>>: diesel::associations::HasTable`  |  = note: this failure-note originates in the macro `diesel::table` (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [check_well_formed] checking that `db::schema::users::<impl at api/src/db/schema.rs:54:1: 66:2>` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 check_mod_type_wf(api[811f]::db::schema::users)
end of try_mark_green dep node stack
error: could not compile `api` (bin "api")
```

<!--
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>