Skip to content

"assertion failed: !projection_ty.has_escaping_regions()" with closure and associated type #29835

Closed
@eefriedman

Description

@eefriedman
trait Inner {
    type T;
}

impl<'a> Inner for &'a i32 {
    type T = i32;
}

fn main() {
  let x = |x| -> <&i32 as Inner>::T { *x };
}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'assertion failed: !projection_ty.has_escaping_regions()', src/librustc/middle/traits/fulfill.rs:149
stack backtrace:
   1:     0x7f52b131fecc - sys::backtrace::tracing::imp::write::h75096aefc5daabfdQDt
   2:     0x7f52b13285ba - panicking::log_panic::h074efb00ffa0c687aqx
   3:     0x7f52b12de5ba - sys_common::unwind::begin_unwind_inner::h581753ef184fd220ivs
   4:     0x7f52aed28e6f - sys_common::unwind::begin_unwind::h9428703455056690702
   5:     0x7f52aefdea53 - middle::traits::fulfill::FulfillmentContext<'tcx>::normalize_projection_type::h5f52e43af4f9c0059sT
   6:     0x7f52afe1e47d - check::FnCtxt<'a, 'tcx>::normalize_associated_type::hbdbae43be670d320p2q
   7:     0x7f52afdee027 - check::FnCtxt<'a, 'tcx>.AstConv<'tcx>::projected_ty::ha20b0a56cb63ce59UHq
   8:     0x7f52afe763fe - astconv::qpath_to_ty::hb88bde258a783395Jbx
   9:     0x7f52afe5d16b - astconv::finish_resolving_def_to_ty::hb7f9bf159e1148faXmx
  10:     0x7f52afe2411f - astconv::ast_ty_to_ty::h38cf5ea0249ba76dLox
  11:     0x7f52afdec81c - check::closure::check_expr_closure::h1d04c5c814757366txm
  12:     0x7f52afe40fa8 - check::check_expr_with_unifier::h42356118614520124
  13:     0x7f52afe60663 - check::check_decl_initializer::h334ede296ceea5c193t
  14:     0x7f52afe606e4 - check::check_decl_local::h12b21c5d281a63ecn5t
  15:     0x7f52afe607e3 - check::check_stmt::hf4ecae8c0ba1e88bg7t
  16:     0x7f52afe1a3d0 - check::check_block_with_expected::hcab69be31983aac8dbu
  17:     0x7f52afdee6e6 - check::check_fn::h3e98663611e2442aHMp
  18:     0x7f52afe139d9 - check::check_bare_fn::hc36ed50f1eba9146ABp
  19:     0x7f52afe11198 - check::check_item_body::h8962f1dd30f4a7dcx3p
  20:     0x7f52afecf9c2 - check_crate::h8a914941619a715a7qE
  21:     0x7f52b1838c75 - driver::phase_3_run_analysis_passes::closure.22365
  22:     0x7f52b1835877 - middle::ty::context::ctxt<'tcx>::create_and_enter::h3781535353480941046
  23:     0x7f52b18308a3 - driver::phase_3_run_analysis_passes::h8173353897596142097
  24:     0x7f52b1812857 - driver::compile_input::h23b288fcb72aa11acca
  25:     0x7f52b1901639 - run_compiler::h0000145acc5f7b5dbxc
  26:     0x7f52b18febf8 - sys_common::unwind::try::try_fn::h15957305491151013021
  27:     0x7f52b131d538 - __rust_try
  28:     0x7f52b130d15b - sys_common::unwind::try::inner_try::he55d5a78f340f1afQrs
  29:     0x7f52b18fef20 - boxed::F.FnBox<A>::call_box::h10013595788438212684
  30:     0x7f52b1326c13 - sys::thread::Thread::new::thread_start::hac6bae05f2c08abbTLw
  31:     0x7f52aa915181 - start_thread
  32:     0x7f52b0f8a47c - __clone
  33:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions