rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.91k stars 12.68k forks source link

ICE: Cannot convert erased region to a region VID #131603

Open cycle-five opened 1 week ago

cycle-five commented 1 week ago

Code

https://gist.github.com/cycle-five/fd672ed0d7d507cf6ad05f6484261f96

Meta

rustc --version --verbose:

(base) lothrop@helheim:~/src/casinobuddy.app$ rustc --version --verbose
rustc 1.83.0-nightly (1bc403daa 2024-10-11)
binary: rustc
commit-hash: 1bc403daadbebb553ccc211a0a8eebb73989665f
commit-date: 2024-10-11
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Error output

    Checking casino-buddy v0.1.0 (/home/lothrop/src/casinobuddy.app)
error: optional sqlx feature `uuid` required for type UUID of param #1
   --> src/lib.rs:117:28
    |
117 |           let transactions = sqlx::query_as!(
    |  ____________________________^
118 | |                 Transaction,
119 | |                 r#"SELECT * FROM "transaction" WHERE user_id = $1"#,
120 | |                 user_id
121 | |             )
    | |_____________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: optional sqlx feature `uuid` required for type UUID of column #1 ("id")
   --> src/lib.rs:129:28
    |
129 |           let transactions = sqlx::query_as!(
    |  ____________________________^
130 | |                 Transaction,
131 | |                 r#"SELECT * FROM "transaction" ORDER BY created_at desc"#,
132 | |             )
    | |_____________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: optional sqlx feature `uuid` required for type UUID of column #2 ("user_id")
   --> src/lib.rs:129:28
    |
129 |           let transactions = sqlx::query_as!(
    |  ____________________________^
130 | |                 Transaction,
131 | |                 r#"SELECT * FROM "transaction" ORDER BY created_at desc"#,
132 | |             )
    | |_____________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: optional sqlx feature `uuid` required for type UUID of column #3 ("casino_id")
   --> src/lib.rs:129:28
    |
129 |           let transactions = sqlx::query_as!(
    |  ____________________________^
130 | |                 Transaction,
131 | |                 r#"SELECT * FROM "transaction" ORDER BY created_at desc"#,
132 | |             )
    | |_____________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: optional sqlx feature `uuid` required for type UUID of param #1
   --> src/lib.rs:140:20
    |
140 |         let user = sqlx::query_as!(User, r#"SELECT * FROM "user" WHERE id = $1"#, user_id)
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: error returned from database: syntax error at or near "user"
   --> src/lib.rs:180:23
    |
180 |           let user_id = sqlx::query_as!(
    |  _______________________^
181 | |             CBUserId,
182 | |             "INSERT INTO user created_at VALUES NOW() RETURNING id"
183 | |         )
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: optional sqlx feature `uuid` required for type UUID of param #1
   --> src/lib.rs:198:27
    |
198 |           let transaction = sqlx::query_as!(
    |  ___________________________^
199 | |             Transaction,
200 | |             r#"INSERT INTO "transaction" (user_id, casino_id, cost, benefit, notes) VALUES ($1, $2, $3, $4, $5) RETURNING *"#,
201 | |             user_id,
...   |
205 | |             notes
206 | |         )
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Uuid: From<()>` is not satisfied
   --> src/lib.rs:129:28
    |
129 |           let transactions = sqlx::query_as!(
    |  ____________________________^
130 | |                 Transaction,
131 | |                 r#"SELECT * FROM "transaction" ORDER BY created_at desc"#,
132 | |             )
    | |_____________^ the trait `From<()>` is not implemented for `Uuid`, which is required by `(): Into<_>`
    |
    = help: the following other types implement trait `From<T>`:
              `Uuid` implements `From<Braced>`
              `Uuid` implements `From<Hyphenated>`
              `Uuid` implements `From<Urn>`
              `Uuid` implements `From<uuid::fmt::Simple>`
    = note: required for `()` to implement `Into<Uuid>`
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:907:36: cannot convert `'{erased}` to a region vid

thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:907:36:
Box<dyn Any>
stack backtrace:
   0:     0x7f72961cac6a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h10effc2e897f3f44
   1:     0x7f7296a034a6 - core::fmt::write::hbd15d6610b1ec6a0
   2:     0x7f7297c1f351 - std::io::Write::write_fmt::h001054fbeb78f30b
   3:     0x7f72961caac2 - std::sys::backtrace::BacktraceLock::print::h379243fdc830b8e1
   4:     0x7f72961ccf96 - std::panicking::default_hook::{{closure}}::h5f0acb8207356983
   5:     0x7f72961ccde0 - std::panicking::default_hook::h6e553cabd993e75a
   6:     0x7f72952256ff - std[a52682fb6709fd50]::panicking::update_hook::<alloc[6c1b03e26bdbf4ed]::boxed::Box<rustc_driver_impl[193eb2676e99316f]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f72961cd6a8 - std::panicking::rust_panic_with_hook::h41309167c2756168
   8:     0x7f729525f861 - std[a52682fb6709fd50]::panicking::begin_panic::<rustc_errors[238ee18d8670766c]::ExplicitBug>::{closure#0}
   9:     0x7f7295252906 - std[a52682fb6709fd50]::sys::backtrace::__rust_end_short_backtrace::<std[a52682fb6709fd50]::panicking::begin_panic<rustc_errors[238ee18d8670766c]::ExplicitBug>::{closure#0}, !>
  10:     0x7f72952528c3 - std[a52682fb6709fd50]::panicking::begin_panic::<rustc_errors[238ee18d8670766c]::ExplicitBug>
  11:     0x7f72952690f1 - <rustc_errors[238ee18d8670766c]::diagnostic::BugAbort as rustc_errors[238ee18d8670766c]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f72958c0784 - rustc_middle[b51483a42336d3d3]::util::bug::opt_span_bug_fmt::<rustc_span[66abce9569f09a61]::span_encoding::Span>::{closure#0}
  13:     0x7f72958a670a - rustc_middle[b51483a42336d3d3]::ty::context::tls::with_opt::<rustc_middle[b51483a42336d3d3]::util::bug::opt_span_bug_fmt<rustc_span[66abce9569f09a61]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f72958a659b - rustc_middle[b51483a42336d3d3]::ty::context::tls::with_context_opt::<rustc_middle[b51483a42336d3d3]::ty::context::tls::with_opt<rustc_middle[b51483a42336d3d3]::util::bug::opt_span_bug_fmt<rustc_span[66abce9569f09a61]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f7292df7de0 - rustc_middle[b51483a42336d3d3]::util::bug::bug_fmt
  16:     0x7f7296fbe2e3 - <rustc_borrowck[ec4bdca597244b1a]::type_check::TypeChecker>::push_region_constraints
  17:     0x7f72977740c6 - <rustc_borrowck[ec4bdca597244b1a]::type_check::TypeChecker>::fully_perform_op::<(), rustc_borrowck[ec4bdca597244b1a]::type_check::InstantiateOpaqueType>
  18:     0x7f7297773cb5 - <rustc_borrowck[ec4bdca597244b1a]::type_check::relate_tys::NllTypeRelating>::relate_opaques
  19:     0x7f7296bf30f7 - <rustc_borrowck[ec4bdca597244b1a]::type_check::TypeChecker>::typeck_mir
  20:     0x7f7297a7e4bd - rustc_borrowck[ec4bdca597244b1a]::type_check::type_check
  21:     0x7f7296a66256 - rustc_borrowck[ec4bdca597244b1a]::nll::compute_regions
  22:     0x7f7297a28412 - rustc_borrowck[ec4bdca597244b1a]::do_mir_borrowck
  23:     0x7f7297a1a747 - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7f7296e2f6d7 - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::VecCache<rustc_span[66abce9569f09a61]::def_id::LocalDefId, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  25:     0x7f7296dce134 - rustc_query_impl[5f5d00e75427f666]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  26:     0x7f7297252bbf - rustc_middle[b51483a42336d3d3]::query::plumbing::query_get_at::<rustc_query_system[cc7041099c9419f9]::query::caches::VecCache<rustc_span[66abce9569f09a61]::def_id::LocalDefId, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>>
  27:     0x7f729785ad0b - rustc_hir_analysis[ec29c66e43109044]::collect::type_of::type_of_opaque
  28:     0x7f729785ab65 - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f7296dd1f7b - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::DefIdCache<rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  30:     0x7f7297ba74b9 - rustc_query_impl[5f5d00e75427f666]::query_impl::type_of_opaque::get_query_incr::__rust_end_short_backtrace
  31:     0x7f729723cf40 - rustc_middle[b51483a42336d3d3]::query::plumbing::query_get_at::<rustc_query_system[cc7041099c9419f9]::query::caches::DefIdCache<rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>>
  32:     0x7f7293acf6c5 - rustc_hir_analysis[ec29c66e43109044]::collect::type_of::type_of
  33:     0x7f7296d3cbaa - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>
  34:     0x7f7296dd1f7b - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::DefIdCache<rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  35:     0x7f7296dcfa76 - rustc_query_impl[5f5d00e75427f666]::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
  36:     0x7f729723cf40 - rustc_middle[b51483a42336d3d3]::query::plumbing::query_get_at::<rustc_query_system[cc7041099c9419f9]::query::caches::DefIdCache<rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 8usize]>>>
  37:     0x7f72978c537e - rustc_hir_analysis[ec29c66e43109044]::check::check::check_item_type
  38:     0x7f72943c9330 - rustc_hir_analysis[ec29c66e43109044]::check::wfcheck::check_well_formed
  39:     0x7f72973799ab - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7f7296dc769f - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::VecCache<rustc_span[66abce9569f09a61]::def_id::LocalDefId, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  41:     0x7f7296dc6e78 - rustc_query_impl[5f5d00e75427f666]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
  42:     0x7f7297379a3d - rustc_middle[b51483a42336d3d3]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[cc7041099c9419f9]::query::caches::VecCache<rustc_span[66abce9569f09a61]::def_id::LocalDefId, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>, ()>
  43:     0x7f7297379fff - rustc_hir_analysis[ec29c66e43109044]::check::wfcheck::check_mod_type_wf
  44:     0x7f7297379a65 - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7f7297907c04 - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::DefaultCache<rustc_span[66abce9569f09a61]::def_id::LocalModDefId, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  46:     0x7f72979088db - rustc_query_impl[5f5d00e75427f666]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  47:     0x7f7296e2927b - rustc_hir_analysis[ec29c66e43109044]::check_crate
  48:     0x7f7296e25fd7 - rustc_interface[edd3a01c1bde3f2a]::passes::run_required_analyses
  49:     0x7f729774f15e - rustc_interface[edd3a01c1bde3f2a]::passes::analysis
  50:     0x7f729774f131 - rustc_query_impl[5f5d00e75427f666]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f5d00e75427f666]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f72979396cd - rustc_query_system[cc7041099c9419f9]::query::plumbing::try_execute_query::<rustc_query_impl[5f5d00e75427f666]::DynamicConfig<rustc_query_system[cc7041099c9419f9]::query::caches::SingleCache<rustc_middle[b51483a42336d3d3]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f5d00e75427f666]::plumbing::QueryCtxt, true>
  52:     0x7f72979391ba - rustc_query_impl[5f5d00e75427f666]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  53:     0x7f72977770de - rustc_interface[edd3a01c1bde3f2a]::interface::run_compiler::<core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>, rustc_driver_impl[193eb2676e99316f]::run_compiler::{closure#0}>::{closure#1}
  54:     0x7f729788c450 - std[a52682fb6709fd50]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[edd3a01c1bde3f2a]::util::run_in_thread_with_globals<rustc_interface[edd3a01c1bde3f2a]::util::run_in_thread_pool_with_globals<rustc_interface[edd3a01c1bde3f2a]::interface::run_compiler<core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>, rustc_driver_impl[193eb2676e99316f]::run_compiler::{closure#0}>::{closure#1}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>::{closure#0}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>
  55:     0x7f729788cb17 - <<std[a52682fb6709fd50]::thread::Builder>::spawn_unchecked_<rustc_interface[edd3a01c1bde3f2a]::util::run_in_thread_with_globals<rustc_interface[edd3a01c1bde3f2a]::util::run_in_thread_pool_with_globals<rustc_interface[edd3a01c1bde3f2a]::interface::run_compiler<core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>, rustc_driver_impl[193eb2676e99316f]::run_compiler::{closure#0}>::{closure#1}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>::{closure#0}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aa94f1cb029d72f2]::result::Result<(), rustc_span[66abce9569f09a61]::ErrorGuaranteed>>::{closure#1} as core[aa94f1cb029d72f2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f729788da01 - std::sys::pal::unix::thread::Thread::new::thread_start::h51ead510c5edae48
  57:     0x7f729189ca94 - start_thread
                               at ./nptl/pthread_create.c:447:8
  58:     0x7f7291929c3c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
  59:                0x0 - <unknown>

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/lothrop/src/casinobuddy.app/rustc-ice-2024-10-12T13_52_24-1224005.txt` to your bug report

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 [mir_borrowck] borrow-checking `get_app`
#1 [type_of_opaque] computing type of opaque `get_app::{opaque#0}`
end of query stack
For more information about this error, try `rustc --explain E0277`.
error: could not compile `casino-buddy` (lib) due to 8 previous errors
error: `cargo check` failed with status: exit status: 101
Backtrace

``` ```

rustc-ice-2024-10-12T13_52_24-1224005.txt

cycle-five commented 1 week ago

https://gist.github.com/cycle-five/fd672ed0d7d507cf6ad05f6484261f96

cyrgani commented 1 week ago

Probably the same as #131050.