Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic (&A -> T) -> (&'a A -> Box<dyn Any + 'a>) crashes #125891

Open
ItzShiney opened this issue Jun 2, 2024 · 3 comments
Open

Generic (&A -> T) -> (&'a A -> Box<dyn Any + 'a>) crashes #125891

ItzShiney opened this issue Jun 2, 2024 · 3 comments
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ItzShiney
Copy link

ItzShiney commented Jun 2, 2024

I'm not sure if this is a minimal example, but I couldn't shrink it any more.

Generic T is necessary, A can be any type.

Code

type A = ();

fn f<T>(f: impl FnOnce(&A) -> T) -> impl for<'a> FnOnce(&'a A) -> Box<dyn std::any::Any + 'a> {
    move |a| Box::new(f(a))
}

Meta

The bug exists in both the latest stable and the latest nightly.

rustc --version --verbose:

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-pc-windows-msvc
release: 1.78.0
LLVM version: 18.1.2

rustc 1.80.0-nightly (f67a1acc0 2024-06-01)
binary: rustc
commit-hash: f67a1acc04c7ecbf05751b17592dd8d245b75256
commit-date: 2024-06-01
host: x86_64-pc-windows-msvc
release: 1.80.0-nightly
LLVM version: 18.1.6

Error output

thread 'rustc' panicked at compiler\rustc_borrowck\src\type_check\free_region_relations.rs:97:9:
can't find an upper bound!?
Backtrace

stack backtrace:
   0:     0x7ffd6322d623 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffd6322d623 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffd6322d623 - std::backtrace::Backtrace::create
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\backtrace.rs:331
   3:     0x7ffd6322d56a - std::backtrace::Backtrace::force_capture
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\backtrace.rs:312
   4:     0x7ffd5f276140 - memchr
   5:     0x7ffd63247187 - alloc::boxed::impl$50::call
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\alloc\src\boxed.rs:2077
   6:     0x7ffd63247187 - std::panicking::rust_panic_with_hook
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:799
   7:     0x7ffd63246fd9 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:656
   8:     0x7ffd6324450f - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\sys_common\backtrace.rs:171
   9:     0x7ffd63246cc8 - std::panicking::begin_panic_handler
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:652
  10:     0x7ffd6329e054 - core::panicking::panic_fmt
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\core\src\panicking.rs:72
  11:     0x7ffd5f9a01c6 - <rustc_borrowck[47dc6bdb74f71e32]::region_infer::RegionInferenceContext>::eval_equal
  12:     0x7ffd5e41001e - rustc_borrowck[47dc6bdb74f71e32]::dataflow::calculate_borrows_out_of_scope_at_location
  13:     0x7ffd5e4f66e1 - <rustc_borrowck[47dc6bdb74f71e32]::type_check::relate_tys::NllTypeRelating as rustc_middle[415a98e6f835205a]::ty::relate::TypeRelation>::regions
  14:     0x7ffd5e45b7fc - rustc_borrowck[47dc6bdb74f71e32]::mir_borrowck
  15:     0x7ffd5e91619a - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  16:     0x7ffd5e860989 - rustc_ty_utils[2e11d027a4d062f9]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  17:     0x7ffd5e91fc2f - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  18:     0x7ffd5d8b01d8 - <rustc_pattern_analysis[cee2a93862cfc37c]::rustc::RustcPatCtxt as rustc_pattern_analysis[cee2a93862cfc37c]::PatCx>::lint_non_contiguous_range_endpoints
  19:     0x7ffd5d8ca93a - <rustc_borrowck[47dc6bdb74f71e32]::type_check::relate_tys::NllTypeRelating as rustc_infer[97ab8c565f63bbbc]::infer::relate::combine::ObligationEmittingRelation>::register_obligations
  20:     0x7ffd5e4b2e87 - <rustc_borrowck[47dc6bdb74f71e32]::type_check::relate_tys::NllTypeRelating as rustc_middle[415a98e6f835205a]::ty::relate::TypeRelation>::regions
  21:     0x7ffd5e435c3f - <&mut rustc_borrowck[47dc6bdb74f71e32]::type_check::constraint_conversion::ConstraintConversion as rustc_infer[97ab8c565f63bbbc]::infer::outlives::obligations::TypeOutlivesDelegate>::push_verify
  22:     0x7ffd5e403ee7 - rustc_borrowck[47dc6bdb74f71e32]::dataflow::calculate_borrows_out_of_scope_at_location
  23:     0x7ffd5e4f66e1 - <rustc_borrowck[47dc6bdb74f71e32]::type_check::relate_tys::NllTypeRelating as rustc_middle[415a98e6f835205a]::ty::relate::TypeRelation>::regions
  24:     0x7ffd5e45b7fc - rustc_borrowck[47dc6bdb74f71e32]::mir_borrowck
  25:     0x7ffd5e91619a - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  26:     0x7ffd5e860989 - rustc_ty_utils[2e11d027a4d062f9]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  27:     0x7ffd5e91fc2f - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  28:     0x7ffd5e0d6245 - <rustc_hir_typeck[8b16c411857e2a7d]::upvar::InferBorrowKind as rustc_hir_typeck[8b16c411857e2a7d]::expr_use_visitor::Delegate>::borrow
  29:     0x7ffd5d829b13 - rustc_hir_analysis[fa2df6f2e5566255]::collect::type_of::type_of_opaque
  30:     0x7ffd5da99a4a - <dyn std[bf373edb648c61c3]::io::Write as nu_ansi_term[7ca241b111b77143]::write::AnyWrite>::write_str
  31:     0x7ffd5e809f2f - rustc_ty_utils[2e11d027a4d062f9]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  32:     0x7ffd5daa0a55 - rustc_query_impl[f6e26b53264cdf7d]::query_system
  33:     0x7ffd5f601bef - <rustc_hir_typeck[8b16c411857e2a7d]::upvar::InferBorrowKind as rustc_hir_typeck[8b16c411857e2a7d]::expr_use_visitor::Delegate>::mutate
  34:     0x7ffd5e13b958 - rustc_hir_analysis[fa2df6f2e5566255]::collect::type_of::type_of
  35:     0x7ffd5e91759f - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  36:     0x7ffd5e809f2f - rustc_ty_utils[2e11d027a4d062f9]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  37:     0x7ffd5e918c56 - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  38:     0x7ffd5f601bef - <rustc_hir_typeck[8b16c411857e2a7d]::upvar::InferBorrowKind as rustc_hir_typeck[8b16c411857e2a7d]::expr_use_visitor::Delegate>::mutate
  39:     0x7ffd5e1026a4 - rustc_hir_analysis[fa2df6f2e5566255]::check::wfcheck::check_well_formed
  40:     0x7ffd5e91685a - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  41:     0x7ffd5e866e35 - rustc_ty_utils[2e11d027a4d062f9]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  42:     0x7ffd5e926039 - rustc_query_impl[f6e26b53264cdf7d]::plumbing::query_key_hash_verify_all
  43:     0x7ffd5e11498e - rustc_hir_analysis[fa2df6f2e5566255]::check::wfcheck::check_mod_type_wf
  44:     0x7ffd5da9a64a - <dyn std[bf373edb648c61c3]::io::Write as nu_ansi_term[7ca241b111b77143]::write::AnyWrite>::write_str
  45:     0x7ffd5d9e5f45 - rustc_ty_utils[2e11d027a4d062f9]::ty::adt_sized_constraint
  46:     0x7ffd5daabbc2 - rustc_query_impl[f6e26b53264cdf7d]::query_system
  47:     0x7ffd5e1562df - rustc_hir_analysis[fa2df6f2e5566255]::check_crate
  48:     0x7ffd5deb27f2 - <rustc_interface[3972c3fa63dc4815]::passes::LintStoreExpandImpl as rustc_expand[aab009fac10e5cb6]::base::LintStoreExpand>::pre_expansion_lint
  49:     0x7ffd5b0f7517 - rustc_interface[3972c3fa63dc4815]::passes::create_global_ctxt
  50:     0x7ffd5da9c0ba - <dyn std[bf373edb648c61c3]::io::Write as nu_ansi_term[7ca241b111b77143]::write::AnyWrite>::write_str
  51:     0x7ffd5d9bbfc9 - rustc_ty_utils[2e11d027a4d062f9]::ty::adt_sized_constraint
  52:     0x7ffd5daa1623 - rustc_query_impl[f6e26b53264cdf7d]::query_system
  53:     0x7ffd5b0b4d8d - _LNan_C
  54:     0x7ffd5b0b214f - _LNan_C
  55:     0x7ffd5b0b9e49 - _LNan_C
  56:     0x7ffd6325838d - alloc::boxed::impl$48::call_once
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\alloc\src\boxed.rs:2063
  57:     0x7ffd6325838d - alloc::boxed::impl$48::call_once
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\alloc\src\boxed.rs:2063
  58:     0x7ffd6325838d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\sys\pal\windows\thread.rs:52
  59:     0x7ffddef27344 - BaseThreadInitThunk
  60:     0x7ffddf8226b1 - RtlUserThreadStart


rustc version: 1.80.0-nightly (f67a1acc0 2024-06-01)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [mir_borrowck] borrow-checking `f::{closure#0}`
#1 [mir_borrowck] borrow-checking `f`
#2 [type_of_opaque] computing type of opaque `f::{opaque#0}`
#3 [type_of] computing type of `f::{opaque#0}`
#4 [check_well_formed] checking that `f::{opaque#0}` is well-formed
#5 [check_mod_type_wf] checking that types are well-formed in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
delayed bug: {OpaqueTypeKey { def_id: DefId(0:10 ~ testing[c4fb]::f::{opaque#0}), args: [T/#0, impl FnOnce(&A) -> T/#1] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src\lib.rs:4:5: 4:28 (#0), ty: Closure(DefId(0:7 ~ testing[c4fb]::f::{closure#0}), [T/#0, impl FnOnce(&A) -> T/#1, i32, Binder(extern "RustCall" fn((&'^0 (),)) -> std::boxed::Box<dyn [Binder(Trait(std::any::Any), [])] + '^0, std::alloc::Global>, [Region(BrAnon)]), (impl FnOnce(&A) -> T/#1,)]) } }}
   0: std::backtrace_rs::backtrace::dbghelp64::trace
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2: std::backtrace::Backtrace::create
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\backtrace.rs:331
   3: std::backtrace::Backtrace::capture
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\backtrace.rs:296
   4: <rustc_errors::DiagCtxt>::emit_future_breakage_report
   5: <rustc_errors::DiagCtxt>::emit_diagnostic
   6: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   7: <rustc_infer::infer::opaque_types::table::OpaqueTypeStorage as core::ops::drop::Drop>::drop
   8: rustc_pattern_analysis::analyze_match
   9: <rustc_pattern_analysis::errors::NonExhaustiveOmittedPatternLintOnArm as rustc_errors::diagnostic::LintDiagnostic<()>>::decorate_lint
  10: <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_middle::ty::relate::TypeRelation>::regions
  11: _CallSettingFrame
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\amd64\handlers.asm:49
  12: __FrameHandler3::FrameUnwindToState
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp:1222
  13: __FrameHandler3::FrameUnwindToEmptyState
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp:255
  14: __InternalCxxFrameHandler<__FrameHandler3>
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp:355
  15: __CxxFrameHandler3
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp:281
  16: _chkstk
  17: RtlUnwindEx
  18: __FrameHandler3::UnwindNestedFrames
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp:759
  19: CatchIt<__FrameHandler3>
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp:1326
  20: FindHandler<__FrameHandler3>
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp:670
  21: __InternalCxxFrameHandler<__FrameHandler3>
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\frame.cpp:396
  22: __CxxFrameHandler3
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp:281
  23: _chkstk
  24: RtlRaiseException
  25: RtlRaiseException
  26: RaiseException
  27: _CxxThrowException
             at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\throw.cpp:81
  28: panic_unwind::real_imp::panic
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\panic_unwind\src\seh.rs:353
  29: panic_unwind::__rust_start_panic
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\panic_unwind\src\lib.rs:108
  30: std::panicking::rust_panic
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:847
  31: std::panicking::rust_panic_with_hook
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:817
  32: std::panicking::begin_panic_handler::closure$0
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:656
  33: std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\sys_common\backtrace.rs:171
  34: std::panicking::begin_panic_handler
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\panicking.rs:652
  35: core::panicking::panic_fmt
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\core\src\panicking.rs:72
  36: <rustc_borrowck::region_infer::RegionInferenceContext>::eval_equal
  37: rustc_borrowck::dataflow::calculate_borrows_out_of_scope_at_location
  38: <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_middle::ty::relate::TypeRelation>::regions
  39: rustc_borrowck::mir_borrowck
  40: rustc_query_impl::plumbing::query_key_hash_verify_all
  41: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  42: rustc_query_impl::plumbing::query_key_hash_verify_all
  43: <rustc_pattern_analysis::rustc::RustcPatCtxt as rustc_pattern_analysis::PatCx>::lint_non_contiguous_range_endpoints
  44: <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_infer::infer::relate::combine::ObligationEmittingRelation>::register_obligations
  45: <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_middle::ty::relate::TypeRelation>::regions
  46: <&mut rustc_borrowck::type_check::constraint_conversion::ConstraintConversion as rustc_infer::infer::outlives::obligations::TypeOutlivesDelegate>::push_verify
  47: rustc_borrowck::dataflow::calculate_borrows_out_of_scope_at_location
  48: <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_middle::ty::relate::TypeRelation>::regions
  49: rustc_borrowck::mir_borrowck
  50: rustc_query_impl::plumbing::query_key_hash_verify_all
  51: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  52: rustc_query_impl::plumbing::query_key_hash_verify_all
  53: <rustc_hir_typeck::upvar::InferBorrowKind as rustc_hir_typeck::expr_use_visitor::Delegate>::borrow
  54: rustc_hir_analysis::collect::type_of::type_of_opaque
  55: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  56: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  57: rustc_query_impl::query_system
  58: <rustc_hir_typeck::upvar::InferBorrowKind as rustc_hir_typeck::expr_use_visitor::Delegate>::mutate
  59: rustc_hir_analysis::collect::type_of::type_of
  60: rustc_query_impl::plumbing::query_key_hash_verify_all
  61: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  62: rustc_query_impl::plumbing::query_key_hash_verify_all
  63: <rustc_hir_typeck::upvar::InferBorrowKind as rustc_hir_typeck::expr_use_visitor::Delegate>::mutate
  64: rustc_hir_analysis::check::wfcheck::check_well_formed
  65: rustc_query_impl::plumbing::query_key_hash_verify_all
  66: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  67: rustc_query_impl::plumbing::query_key_hash_verify_all
  68: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
  69: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  70: rustc_ty_utils::ty::adt_sized_constraint
  71: rustc_query_impl::query_system
  72: rustc_hir_analysis::check_crate
  73: <rustc_interface::passes::LintStoreExpandImpl as rustc_expand::base::LintStoreExpand>::pre_expansion_lint
  74: rustc_interface::passes::create_global_ctxt
  75: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  76: rustc_ty_utils::ty::adt_sized_constraint
  77: rustc_query_impl::query_system
  78: _LNan_C
  79: _LNan_C
  80: _LNan_C
  81: alloc::boxed::impl$48::call_once
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\alloc\src\boxed.rs:2063
  82: alloc::boxed::impl$48::call_once
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\alloc\src\boxed.rs:2063
  83: std::sys::pal::windows::thread::impl$0::new::thread_start
             at /rustc/f67a1acc04c7ecbf05751b17592dd8d245b75256/library\std\src\sys\pal\windows\thread.rs:52
  84: BaseThreadInitThunk
  85: RtlUserThreadStart

@ItzShiney ItzShiney added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 2, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 2, 2024
@ItzShiney ItzShiney changed the title Generic (&A -> T) -> (&'a A -> Box<dyn Any + 'a>) crashes Generic (&A -> T) -> (&'a A -> Box<dyn Any + 'a>) crashes Jun 2, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 2, 2024
@matthiaskrgr
Copy link
Member

probably duplicate of #122704

@matthiaskrgr
Copy link
Member

proly related to #122704

@theemathas
Copy link
Contributor

theemathas commented Jun 15, 2024

I tried to minimize this, and I can't go smaller than this:

trait IsStatic: 'static {}

impl<T: 'static> IsStatic for T {}

fn foo<T>(x: Box<T>) -> impl for<'a> FnOnce(&'a ()) -> Box<dyn IsStatic + 'a> {
    move |_| x
}
Error output
   Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:97:9:
can't find an upper bound!?
stack backtrace:
   0:     0x7f68c8ef2ae5 - std::backtrace_rs::backtrace::libunwind::trace::hd03f93528d46491d
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7f68c8ef2ae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h74dc0b19b052c2ae
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f68c8ef2ae5 - std::sys_common::backtrace::_print_fmt::h9a3bc0e652cf7b69
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f68c8ef2ae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4837d7bdd071c26e
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f68c8f4377b - core::fmt::rt::Argument::fmt::h5f4cca7a86de3ac3
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/fmt/rt.rs:165:63
   5:     0x7f68c8f4377b - core::fmt::write::h58fee7e5e6f828bb
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/fmt/mod.rs:1168:21
   6:     0x7f68c8ee76bf - std::io::Write::write_fmt::h5a54d56832f12d0f
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/io/mod.rs:1835:15
   7:     0x7f68c8ef28be - std::sys_common::backtrace::_print::hf8a2cb55c2c8353b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f68c8ef28be - std::sys_common::backtrace::print::h6b23178d2042c60b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f68c8ef52f9 - std::panicking::default_hook::{{closure}}::h8098cbc85e732f3b
  10:     0x7f68c8ef509c - std::panicking::default_hook::h21b51f336018bc80
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:292:9
  11:     0x7f68cc2277ff - std[e439e5cd3a449d52]::panicking::update_hook::<alloc[b12fd6abffc16fa6]::boxed::Box<rustc_driver_impl[9892696329624aa2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f68c8ef5bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5602e10eecbd0618
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2076:9
  13:     0x7f68c8ef5bff - std::panicking::rust_panic_with_hook::hd1b3711c6ea634e2
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:801:13
  14:     0x7f68c8ef57f3 - std::panicking::begin_panic_handler::{{closure}}::h01c1581833053b47
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:660:13
  15:     0x7f68c8ef2fa9 - std::sys_common::backtrace::__rust_end_short_backtrace::h12d87452272215f0
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f68c8ef54d4 - rust_begin_unwind
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:658:5
  17:     0x7f68c8f3fd33 - core::panicking::panic_fmt::h219f5a3f16bd9a4d
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/panicking.rs:74:14
  18:     0x7f68cc03470a - <rustc_borrowck[d08da6903e11d7f3]::type_check::free_region_relations::UniversalRegionRelations>::non_local_upper_bounds
  19:     0x7f68ca6e587d - rustc_borrowck[d08da6903e11d7f3]::nll::compute_regions
  20:     0x7f68ce4f193a - rustc_borrowck[d08da6903e11d7f3]::do_mir_borrowck
  21:     0x7f68ce4e3a3e - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7f68cd8786ee - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  23:     0x7f68cd87814d - rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f68cdec2860 - rustc_middle[e07a585f38de947]::query::plumbing::query_get_at::<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>>
  25:     0x7f68cdec28ce - <rustc_borrowck[d08da6903e11d7f3]::type_check::TypeChecker>::prove_closure_bounds
  26:     0x7f68cd67659e - <rustc_borrowck[d08da6903e11d7f3]::type_check::TypeChecker>::typeck_mir
  27:     0x7f68ca7165ad - rustc_borrowck[d08da6903e11d7f3]::type_check::type_check
  28:     0x7f68ca6d9ca8 - rustc_borrowck[d08da6903e11d7f3]::nll::compute_regions
  29:     0x7f68ce4f193a - rustc_borrowck[d08da6903e11d7f3]::do_mir_borrowck
  30:     0x7f68ce4e3a3e - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7f68cd8786ee - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  32:     0x7f68cd87814d - rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f68cdd5c6c8 - rustc_middle[e07a585f38de947]::query::plumbing::query_get_at::<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>>
  34:     0x7f68ce39d38a - rustc_hir_analysis[d86af1a4ad06d506]::collect::type_of::type_of_opaque
  35:     0x7f68ce39d1eb - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7f68cd624012 - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::DefIdCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  37:     0x7f68ce642036 - rustc_query_impl[8f9eb950d6cc008f]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f68cdb1c840 - rustc_middle[e07a585f38de947]::query::plumbing::query_get_at::<rustc_query_system[8ccdec27dd679281]::query::caches::DefIdCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>>
  39:     0x7f68cb0ede8b - rustc_hir_analysis[d86af1a4ad06d506]::collect::type_of::type_of
  40:     0x7f68cd6253ea - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  41:     0x7f68cd624012 - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::DefIdCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  42:     0x7f68cd623bbb - rustc_query_impl[8f9eb950d6cc008f]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7f68cdb1c840 - rustc_middle[e07a585f38de947]::query::plumbing::query_get_at::<rustc_query_system[8ccdec27dd679281]::query::caches::DefIdCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>>
  44:     0x7f68c9ef6622 - rustc_hir_analysis[d86af1a4ad06d506]::check::check::check_item_type
  45:     0x7f68caf3001c - rustc_hir_analysis[d86af1a4ad06d506]::check::wfcheck::check_well_formed
  46:     0x7f68cd8629fd - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>
  47:     0x7f68cd862c6a - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_hir[186bee71f654e143]::hir_id::OwnerId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  48:     0x7f68cd8629da - rustc_query_impl[8f9eb950d6cc008f]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  49:     0x7f68cd863741 - rustc_hir_analysis[d86af1a4ad06d506]::check::wfcheck::check_mod_type_wf
  50:     0x7f68cd863587 - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f68ce010f3a - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::DefaultCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalModDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  52:     0x7f68ce010cf5 - rustc_query_impl[8f9eb950d6cc008f]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  53:     0x7f68cd8752cc - rustc_hir_analysis[d86af1a4ad06d506]::check_crate
  54:     0x7f68cdf9c947 - rustc_interface[c905b19a64c8fe9a]::passes::analysis
  55:     0x7f68cdf9c487 - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>
  56:     0x7f68ce38b2a5 - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::SingleCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  57:     0x7f68ce38b00f - rustc_query_impl[8f9eb950d6cc008f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  58:     0x7f68ce24f7d2 - rustc_interface[c905b19a64c8fe9a]::interface::run_compiler::<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}
  59:     0x7f68ce2733a7 - std[e439e5cd3a449d52]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_with_globals<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_pool_with_globals<rustc_interface[c905b19a64c8fe9a]::interface::run_compiler<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>
  60:     0x7f68ce27316a - <<std[e439e5cd3a449d52]::thread::Builder>::spawn_unchecked_<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_with_globals<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_pool_with_globals<rustc_interface[c905b19a64c8fe9a]::interface::run_compiler<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#2} as core[bd37ed12c97f867b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  61:     0x7f68c8effa7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h32b9a9f0c1b7e30b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2062:9
  62:     0x7f68c8effa7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33379ef2bcdd46d5
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2062:9
  63:     0x7f68c8effa7b - std::sys::pal::unix::thread::Thread::new::thread_start::h27a5de020b7d499b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys/pal/unix/thread.rs:108:17
  64:     0x7f68c8e0d609 - start_thread
  65:     0x7f68c8d30353 - clone
  66:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/playground/rustc-ice-2024-06-15T05_34_50-349.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `foo::{closure#0}`
#1 [mir_borrowck] borrow-checking `foo`
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:10 ~ playground[642d]::foo::{opaque#0}), args: [T/#0] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/lib.rs:6:5: 6:15 (#0), ty: Closure(DefId(0:9 ~ playground[642d]::foo::{closure#0}), [T/#0, i32, Binder { value: extern "RustCall" fn((&'^0 (),)) -> std::boxed::Box<dyn [Binder { value: Trait(IsStatic), bound_vars: [] }] + '^0, std::alloc::Global>, bound_vars: [Region(BrAnon)] }, (std::boxed::Box<T/#0, std::alloc::Global>,)]) } }}
  |
  = note: delayed at compiler/rustc_infer/src/infer/opaque_types/table.rs:44:43 - disabled backtrace

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 `/playground/rustc-ice-2024-06-15T05_34_50-349.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
end of query stack
thread 'rustc' panicked at library/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: please make sure that you have updated to the latest nightly

note: please attach the file at `/playground/rustc-ice-2024-06-15T05_34_50-349.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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 `playground` (lib)

Note that the code is invalid, since it should have a T: 'static bound on foo.

Seems identical to the aforementioned #122704 except for having impl instead of dyn

@jieyouxu jieyouxu added A-borrow-checker Area: The borrow checker S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants