rust-lang / rust

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

ICE: borrowck `best_blame_constraint` unwrap on a `None` value, `OpaqueTypeKey { def_id...` #133252

Open Turbo87 opened 5 days ago

Turbo87 commented 5 days ago

Code

Meta

rustc --version --verbose:

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: aarch64-apple-darwin
release: 1.82.0
LLVM version: 19.1.1

Error output

❯ RUST_BACKTRACE=1 cargo build
   Compiling crates_io v0.0.0 (/Users/tbieniek/Code/crates.io)
thread 'rustc' panicked at compiler/rustc_borrowck/src/region_infer/mod.rs:1967:82:
called `Option::unwrap()` on a `None` value

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.82.0 (f6e511eec 2024-10-15) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED] -C linker=rust-lld

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `controllers::user::me::updates::{closure#0}`
#1 [mir_borrowck] borrow-checking `controllers::user::me::updates`
#2 [type_of_opaque] computing type of opaque `controllers::user::me::updates::{opaque#0}`
#3 [type_of] computing type of `controllers::user::me::updates::{opaque#0}`
#4 [check_well_formed] checking that `controllers::user::me::updates::{opaque#0}` is well-formed
#5 [check_mod_type_wf] checking that types are well-formed in module `controllers::user::me`
#6 [analysis] running analysis passes on this crate
end of query stack
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: {OpaqueTypeKey { def_id: DefId(0:19493 ~ crates_io[d4b9]::controllers::user::me::updates::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/controllers/user/me.rs:68:74: 105:2 (#0), ty: Coroutine(DefId(0:1458 ~ crates_io[d4b9]::controllers::user::me::updates::{closure#0}), [(), std::future::ResumeTy, (), std::result::Result<axum_extra::response::ErasedJson, std::boxed::Box<dyn [Binder { value: Trait(util::errors::AppError), bound_vars: [] }] + '?2, std::alloc::Global>>, CoroutineWitness(DefId(0:1458 ~ crates_io[d4b9]::controllers::user::me::updates::{closure#0}), []), (app::AppState, http::request::Parts)]) } }}
  |
  = note: delayed at compiler/rustc_infer/src/infer/opaque_types/table.rs:44:43
             0: std::backtrace::Backtrace::create
             1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             2: <rustc_errors::diagnostic::Diag>::emit_producing_error_guaranteed
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<alloc::string::String>
             4: core::ptr::drop_in_place::<rustc_infer::infer::opaque_types::table::OpaqueTypeStorage>
             5: core::ptr::drop_in_place::<rustc_borrowck::BorrowckInferCtxt>
             6: rustc_borrowck::do_mir_borrowck
             7: rustc_borrowck::mir_borrowck
             8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
             9: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            11: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
            12: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
            13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            14: <rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            16: rustc_query_impl::query_impl::type_of_opaque::get_query_incr::__rust_end_short_backtrace
            17: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>>
            18: rustc_hir_analysis::collect::type_of::type_of
            19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            20: <rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
            21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            22: rustc_query_impl::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
            23: rustc_hir_analysis::check::check::check_item_type
            24: rustc_hir_analysis::check::wfcheck::check_well_formed
            25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            26: <rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_hir::hir_id::OwnerId)>>::call_once
            27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            28: rustc_query_impl::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
            29: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::disabled::try_par_for_each_in<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_impl_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#1}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
            30: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
            31: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            32: <rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalModDefId)>>::call_once
            33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            34: rustc_query_impl::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
            35: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#0}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
            36: rustc_hir_analysis::check_crate
            37: rustc_interface::passes::analysis
            38: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            39: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            41: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
            42: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            43: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            44: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            45: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            46: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            47: std::sys::pal::unix::thread::Thread::new::thread_start
            48: __pthread_joiner_wake

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.82.0 (f6e511eec 2024-10-15) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED] -C linker=rust-lld

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at core/src/panicking.rs:229:5:
panic in a destructor during cleanup

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.82.0 (f6e511eec 2024-10-15) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED] -C linker=rust-lld

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread caused non-unwinding panic. aborting.
error: could not compile `crates_io` (lib)

Caused by:
  process didn't exit successfully: `/Users/tbieniek/.rustup/toolchains/1.82.0-aarch64-apple-darwin/bin/rustc --crate-name crates_io --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=203 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --warn=unused '--warn=rustdoc::unescaped_backticks' '--warn=clippy::todo' --warn=rust_2021_compatibility --warn=rust_2018_idioms --warn=rust_2018_compatibility --warn=nonstandard_style --warn=future_incompatible '--warn=clippy::dbg_macro' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=99351b9735320372 -C extra-filename=-99351b9735320372 --out-dir /Users/tbieniek/Code/crates.io/target/debug/deps -C incremental=/Users/tbieniek/Code/crates.io/target/debug/incremental -L dependency=/Users/tbieniek/Code/crates.io/target/debug/deps --extern anyhow=/Users/tbieniek/Code/crates.io/target/debug/deps/libanyhow-5ca71c7a58ed170f.rmeta --extern async_trait=/Users/tbieniek/Code/crates.io/target/debug/deps/libasync_trait-307a7d505591d425.dylib --extern aws_credential_types=/Users/tbieniek/Code/crates.io/target/debug/deps/libaws_credential_types-81611675731fab26.rmeta --extern aws_ip_ranges=/Users/tbieniek/Code/crates.io/target/debug/deps/libaws_ip_ranges-d9faebcfaf2a57d1.rmeta --extern aws_sdk_cloudfront=/Users/tbieniek/Code/crates.io/target/debug/deps/libaws_sdk_cloudfront-e474f5e76fac66d3.rmeta --extern aws_sdk_sqs=/Users/tbieniek/Code/crates.io/target/debug/deps/libaws_sdk_sqs-822ca5e527aa6078.rmeta --extern axum=/Users/tbieniek/Code/crates.io/target/debug/deps/libaxum-fb262ef8b0d2b21a.rmeta --extern axum_extra=/Users/tbieniek/Code/crates.io/target/debug/deps/libaxum_extra-d1fb8435bf6cb737.rmeta --extern base64=/Users/tbieniek/Code/crates.io/target/debug/deps/libbase64-30d3f1235ae49020.rmeta --extern bigdecimal=/Users/tbieniek/Code/crates.io/target/debug/deps/libbigdecimal-ce42e60acae5ddbf.rmeta --extern bon=/Users/tbieniek/Code/crates.io/target/debug/deps/libbon-c4615a0b2a0e4afe.rmeta --extern cargo_manifest=/Users/tbieniek/Code/crates.io/target/debug/deps/libcargo_manifest-fc5ea574fe898a08.rmeta --extern chrono=/Users/tbieniek/Code/crates.io/target/debug/deps/libchrono-e0f4d3b1f057640e.rmeta --extern clap=/Users/tbieniek/Code/crates.io/target/debug/deps/libclap-d693acc1a86562c5.rmeta --extern colored=/Users/tbieniek/Code/crates.io/target/debug/deps/libcolored-d2305004cb1cbea7.rmeta --extern cookie=/Users/tbieniek/Code/crates.io/target/debug/deps/libcookie-3075eb2a4765c070.rmeta --extern crates_io_cdn_logs=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_cdn_logs-430de7d1a6b9145e.rmeta --extern crates_io_database=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_database-8c1406b9ca7a2d9b.rmeta --extern crates_io_database_dump=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_database_dump-b29343cf5a1de18a.rmeta --extern crates_io_env_vars=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_env_vars-cf8a82b6c3545853.rmeta --extern crates_io_github=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_github-c019efb5ad5a4d45.rmeta --extern crates_io_index=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_index-8adf1152f54775da.rmeta --extern crates_io_markdown=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_markdown-870ef60d34b29ff2.rmeta --extern crates_io_pagerduty=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_pagerduty-42fcc5f007778fa2.rmeta --extern crates_io_tarball=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_tarball-f2a535c2cad06ee8.rmeta --extern crates_io_team_repo=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_team_repo-61fff7575af38f3f.rmeta --extern crates_io_worker=/Users/tbieniek/Code/crates.io/target/debug/deps/libcrates_io_worker-23ba914000f90b5d.rmeta --extern csv=/Users/tbieniek/Code/crates.io/target/debug/deps/libcsv-219aece62ec726b2.rmeta --extern deadpool_diesel=/Users/tbieniek/Code/crates.io/target/debug/deps/libdeadpool_diesel-e0bf930853aa99da.rmeta --extern derive_deref=/Users/tbieniek/Code/crates.io/target/debug/deps/libderive_deref-a287df1790ba5c6d.dylib --extern dialoguer=/Users/tbieniek/Code/crates.io/target/debug/deps/libdialoguer-1104d613c529dc8c.rmeta --extern diesel=/Users/tbieniek/Code/crates.io/target/debug/deps/libdiesel-c4ace3f1ab1d59fb.rmeta --extern diesel_async=/Users/tbieniek/Code/crates.io/target/debug/deps/libdiesel_async-fb768a0d73fb3d45.rmeta --extern diesel_full_text_search=/Users/tbieniek/Code/crates.io/target/debug/deps/libdiesel_full_text_search-a66d600d17830e2a.rmeta --extern diesel_migrations=/Users/tbieniek/Code/crates.io/target/debug/deps/libdiesel_migrations-7bc75d31859a993e.rmeta --extern dotenvy=/Users/tbieniek/Code/crates.io/target/debug/deps/libdotenvy-44dac4d976c9f45d.rmeta --extern flate2=/Users/tbieniek/Code/crates.io/target/debug/deps/libflate2-437a1b6af3f22b45.rmeta --extern futures_util=/Users/tbieniek/Code/crates.io/target/debug/deps/libfutures_util-9a4ad87fb22e8e3e.rmeta --extern hex=/Users/tbieniek/Code/crates.io/target/debug/deps/libhex-3dc383cbf9b09120.rmeta --extern http=/Users/tbieniek/Code/crates.io/target/debug/deps/libhttp-da6e0dc45fb6c606.rmeta --extern http_body_util=/Users/tbieniek/Code/crates.io/target/debug/deps/libhttp_body_util-56ed164f2d59b268.rmeta --extern hyper=/Users/tbieniek/Code/crates.io/target/debug/deps/libhyper-be058bfa354519ca.rmeta --extern indexmap=/Users/tbieniek/Code/crates.io/target/debug/deps/libindexmap-db507b5cc98e5bcf.rmeta --extern indicatif=/Users/tbieniek/Code/crates.io/target/debug/deps/libindicatif-b55e063ede31cf28.rmeta --extern ipnetwork=/Users/tbieniek/Code/crates.io/target/debug/deps/libipnetwork-5a3aa856f5f1c6bb.rmeta --extern json_subscriber=/Users/tbieniek/Code/crates.io/target/debug/deps/libjson_subscriber-47b30049cc5ff60c.rmeta --extern lettre=/Users/tbieniek/Code/crates.io/target/debug/deps/liblettre-fead64a1b8477dd4.rmeta --extern minijinja=/Users/tbieniek/Code/crates.io/target/debug/deps/libminijinja-016e3a23f2e6aba9.rmeta --extern mockall=/Users/tbieniek/Code/crates.io/target/debug/deps/libmockall-a06eb72a0effd3c8.rmeta --extern native_tls=/Users/tbieniek/Code/crates.io/target/debug/deps/libnative_tls-4cec392b2d76b5b6.rmeta --extern oauth2=/Users/tbieniek/Code/crates.io/target/debug/deps/liboauth2-4f9ec6f85fdf646e.rmeta --extern object_store=/Users/tbieniek/Code/crates.io/target/debug/deps/libobject_store-3a2b97f0b728e1eb.rmeta --extern p256=/Users/tbieniek/Code/crates.io/target/debug/deps/libp256-7b2c5669ba82c672.rmeta --extern parking_lot=/Users/tbieniek/Code/crates.io/target/debug/deps/libparking_lot-3fc0ca7f2ad2ab20.rmeta --extern paste=/Users/tbieniek/Code/crates.io/target/debug/deps/libpaste-16af04d90bc67ea6.dylib --extern postgres_native_tls=/Users/tbieniek/Code/crates.io/target/debug/deps/libpostgres_native_tls-1b0ce9b19e455140.rmeta --extern prometheus=/Users/tbieniek/Code/crates.io/target/debug/deps/libprometheus-d28700cd5f48bd0c.rmeta --extern rand=/Users/tbieniek/Code/crates.io/target/debug/deps/librand-3ae4a8fa71126bf0.rmeta --extern reqwest=/Users/tbieniek/Code/crates.io/target/debug/deps/libreqwest-de4e25c98f4ec447.rmeta --extern rss=/Users/tbieniek/Code/crates.io/target/debug/deps/librss-69e970b8b082b7e2.rmeta --extern secrecy=/Users/tbieniek/Code/crates.io/target/debug/deps/libsecrecy-2e5f3b76f1c5dc15.rmeta --extern semver=/Users/tbieniek/Code/crates.io/target/debug/deps/libsemver-8a3039fd3dcd7fcd.rmeta --extern sentry=/Users/tbieniek/Code/crates.io/target/debug/deps/libsentry-99382909ea24cab8.rmeta --extern serde=/Users/tbieniek/Code/crates.io/target/debug/deps/libserde-84c3f579b916f935.rmeta --extern serde_json=/Users/tbieniek/Code/crates.io/target/debug/deps/libserde_json-aa2e259ff63820a5.rmeta --extern sha2=/Users/tbieniek/Code/crates.io/target/debug/deps/libsha2-62b66cfe559c81f1.rmeta --extern spdx=/Users/tbieniek/Code/crates.io/target/debug/deps/libspdx-781d95e4f990d03d.rmeta --extern tar=/Users/tbieniek/Code/crates.io/target/debug/deps/libtar-3442c1d658cdc4f0.rmeta --extern tempfile=/Users/tbieniek/Code/crates.io/target/debug/deps/libtempfile-e7da20a1f1067c86.rmeta --extern thiserror=/Users/tbieniek/Code/crates.io/target/debug/deps/libthiserror-78e82ff47f28fbd9.rmeta --extern tikv_jemallocator=/Users/tbieniek/Code/crates.io/target/debug/deps/libtikv_jemallocator-0d9a7f9692e1ebcf.rmeta --extern tokio=/Users/tbieniek/Code/crates.io/target/debug/deps/libtokio-8d4b40d39bfb0f32.rmeta --extern tokio_postgres=/Users/tbieniek/Code/crates.io/target/debug/deps/libtokio_postgres-f791ee1d2b94c5ab.rmeta --extern toml=/Users/tbieniek/Code/crates.io/target/debug/deps/libtoml-34bd9491a830b9bc.rmeta --extern tower=/Users/tbieniek/Code/crates.io/target/debug/deps/libtower-1e8762fe8201319a.rmeta --extern tower_http=/Users/tbieniek/Code/crates.io/target/debug/deps/libtower_http-9fae09c34c328d92.rmeta --extern tracing=/Users/tbieniek/Code/crates.io/target/debug/deps/libtracing-3060f4f7ebe0a86a.rmeta --extern tracing_subscriber=/Users/tbieniek/Code/crates.io/target/debug/deps/libtracing_subscriber-72afc66271472a0c.rmeta --extern typomania=/Users/tbieniek/Code/crates.io/target/debug/deps/libtypomania-b75a54b8c8632507.rmeta --extern unicode_xid=/Users/tbieniek/Code/crates.io/target/debug/deps/libunicode_xid-6cb93bfb418c350f.rmeta --extern url=/Users/tbieniek/Code/crates.io/target/debug/deps/liburl-650d0b0c5171d7dd.rmeta -C linker=rust-lld -L native=/Users/tbieniek/Code/crates.io/target/debug/build/ring-ced8403dbfcec192/out -L native=/Users/tbieniek/Code/crates.io/target/debug/build/zstd-sys-2d97206ebe9d75d0/out -L native=/opt/homebrew/opt/libpq/lib -L native=/Users/tbieniek/Code/crates.io/target/debug/build/libgit2-sys-55aaf7d7adc49576/out/build -L native=/Users/tbieniek/Code/crates.io/target/debug/build/libssh2-sys-bcbb7f91d703f504/out/build -L 'native=/opt/homebrew/opt/openssl@3/lib' -L native=/Users/tbieniek/Code/crates.io/target/debug/build/psm-a24ca136e31f5ebc/out -L native=/Users/tbieniek/Code/crates.io/target/debug/build/tikv-jemalloc-sys-6a0077a245cdaa58/out/build/lib` (signal: 6, SIGABRT: process abort signal)
Backtrace

``` stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3: core::option::unwrap_failed 4: ::best_blame_constraint::<::free_region_constraint_info::{closure#0}> 5: ::explain_why_borrow_contains_point 6: ::report_borrowed_value_does_not_live_long_enough 7: rustc_borrowck::path_utils::each_borrow_involving_path::<::check_access_for_conflict::{closure#1}, ::check_access_for_conflict::{closure#0}, rustc_borrowck::MirBorrowckCtxt> 8: ::access_place 9: >::visit_terminator_before_primary_effect 10: ::visit_results_in_block:: 11: rustc_mir_dataflow::framework::visitor::visit_results::, rustc_middle::mir::traversal::reverse_postorder::{closure#0}>, rustc_borrowck::do_mir_borrowck::{closure#2}>, rustc_borrowck::MirBorrowckCtxt> 12: rustc_borrowck::do_mir_borrowck 13: rustc_borrowck::mir_borrowck [... omitted 2 frames ...] 14: ::prove_closure_bounds 15: ::check_rvalue 16: ::typeck_mir 17: rustc_borrowck::type_check::type_check 18: rustc_borrowck::nll::compute_regions 19: rustc_borrowck::do_mir_borrowck 20: rustc_borrowck::mir_borrowck [... omitted 2 frames ...] 21: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit [... omitted 2 frames ...] 22: rustc_middle::query::plumbing::query_get_at::>> 23: rustc_hir_analysis::collect::type_of::type_of [... omitted 2 frames ...] 24: rustc_hir_analysis::check::check::check_item_type 25: rustc_hir_analysis::check::wfcheck::check_well_formed [... omitted 2 frames ...] 26: ::run::, rustc_data_structures::sync::parallel::disabled::try_par_for_each_in<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, ::par_impl_items::{closure#0}>::{closure#0}::{closure#0}::{closure#0}> 27: rustc_hir_analysis::check::wfcheck::check_mod_type_wf [... omitted 2 frames ...] 28: ::run::<(), rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_hir::hir_id::OwnerId], ::par_for_each_module::{closure#0}>::{closure#0}::{closure#0}::{closure#0}> 29: rustc_hir_analysis::check_crate 30: rustc_interface::passes::analysis [... omitted 2 frames ...] 31: ::enter::> 32: ::enter::, rustc_span::ErrorGuaranteed>> 33: >::set::, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>> ```

Turbo87 commented 5 days ago

/cc @estebank since this seems to be diagnostics-related (?)

jieyouxu commented 5 days ago

Backtrace looks like #114640. ICE'd while borrow-checking around https://github.com/Turbo87/crates.io/blob/cf1ac7c853bc4cea21a8fd3fdb7e17260d1a242c/src/controllers/user/me.rs#L68.

https://github.com/rust-lang/rust/blob/f6e511eec7342f59a25f7c0534f1dbea00d01b14/compiler/rustc_borrowck/src/region_infer/mod.rs#L1958-L1967

It looks a bit like #114640 and #123157, but #123157 is feature-gated-dependent.

@Turbo87 does it repro if you cargo clean then check/build again?

Turbo87 commented 5 days ago

does it repro if you cargo clean then check/build again?

yep, reproduces every time I run, also when running cargo clean or rm -rf target before the cargo build. also happens on cargo check and cargo clippy.

jieyouxu commented 5 days ago

Thanks for the info. That is certainly curious. @rustbot label +E-needs-mcve

cyrgani commented 5 days ago

Reduced as far as I could:

use std::future::Future;

fn force_send<T: Send>(_: T) {}

fn async_load<'a, T>(this: T) -> impl Future
where
    T: LoadQuery<'a>,
{
    async move {
        LoadQuery::internal_load(this).await;
    }
}

trait AppError: 'static {}
fn ice() -> impl Future<Output = Option<Box<dyn AppError>>> {
    async {
        let user = User {};
        force_send(async_load(&user));
        None
    }
}

struct User {}
trait LoadQuery<'query> {
    type LoadFuture: Future;

    fn internal_load(self) -> Self::LoadFuture
    where
        Self: Sized,
    {
        loop {}
    }
}

impl<'query, 'a> LoadQuery<'query> for &'a User
where
    'a: 'query,
{
    type LoadFuture = SimpleFuture;
}

struct SimpleFuture;
impl Future for SimpleFuture {
    type Output = ();
    fn poll(
        self: std::pin::Pin<&mut Self>,
        _: &mut std::task::Context<'_>,
    ) -> std::task::Poll<Self::Output> {
        loop {}
    }
}

@rustbot label: -E-needs-mcve