Skip to content

ICE (cannot relate bound region) with universally-quantified closure lifetime bound #19009

Closed
@arielb1

Description

@arielb1

The following code:

#![feature(lang_items)]
#![no_std]
#![crate_type="rlib"]
#[lang="sized"] pub trait Sized for Sized? {}

fn ice(f: for<'s> ||:'s) {}
fn main() { ice(||{}) }

causes the following ICE:

panic.rs:7:17: 7:21 error: internal compiler error: cannot relate bound region: ReLateBound(7, BrNamed(DefId { krate: 0, node: 10 }, 's)) <= '_#0r
panic.rs:7 fn main() { ice(||{}) }
                           ^~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/snap3-linux/build/src/libsyntax/diagnostic.rs:116

stack backtrace:
   1:     0x7f2de2506880 - rt::backtrace::imp::write::hcdc2f7be6d055c99Pdt
   2:     0x7f2de2509700 - failure::on_fail::h5788810ad30506feqzt
   3:     0x7f2de25250d0 - unwind::begin_unwind_inner::h95fceca7f7fff8e4E9c
   4:     0x7f2de1486ba0 - unwind::begin_unwind::h17288900196382632715
   5:     0x7f2de1486b20 - diagnostic::SpanHandler::span_bug::hc28ba54728d5da49oZF
   6:     0x7f2de103eeb0 - middle::typeck::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h8d93dddca703b8329uc
   7:     0x7f2de104f250 - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::regions::h3adc46f8245aed4eC1e
   8:     0x7f2de104eff0 - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::contraregions::h20372efe4f6663fe20e
   9:     0x7f2de1051c00 - middle::typeck::infer::combine::Combine::closure_tys::h17253834835442553283
  10:     0x7f2de0ff4270 - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::tys::hc0c072841551908fm9e
  11:     0x7f2de0ff4100 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::subtype::h761550d7283e2cf7y85
  12:     0x7f2de0ff3da0 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::coerce_borrowed_fn::h5519897a090d27f0uQ6
  13:     0x7f2de0ff3d40 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::tys::closure.134443
  14:     0x7f2de0ff19f0 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::unpack_actual_value::h17085816543345179750
  15:     0x7f2de0ff1150 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::tys::he0c4ea99af0e5f6fZ05
  16:     0x7f2de105a890 - middle::typeck::infer::mk_coercety::closure.136277
  17:     0x7f2de105a5f0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::commit_if_ok::closure.136269
  18:     0x7f2de105a480 - middle::typeck::infer::InferCtxt<'a, 'tcx>::commit_unconditionally::h1485868009903534266
  19:     0x7f2de0d9bdc0 - middle::typeck::infer::mk_coercety::ha26368b750869d196di
  20:     0x7f2de0f31de0 - middle::typeck::check::FnCtxt<'a, 'tcx>::mk_assignty::h5bf4da584e36fc1bNkY
  21:     0x7f2de0f31a50 - middle::typeck::check::demand::coerce::h4d0a0c0e48366a432aS
  22:     0x7f2de0f9e380 - middle::typeck::check::check_expr_coercable_to_type::closure.133451
  23:     0x7f2de0f948c0 - middle::typeck::check::check_expr_with_unifier::h304cbc594fc73fa9vGZ
  24:     0x7f2de0f93000 - middle::typeck::check::check_argument_types::h86d271aa00d8ca66p7Y
  25:     0x7f2de0f948c0 - middle::typeck::check::check_expr_with_unifier::h304cbc594fc73fa9vGZ
  26:     0x7f2de0f5a4e0 - middle::typeck::check::check_block_with_expected::hfe6034b5fa76b64aBR1
  27:     0x7f2de0f55f50 - middle::typeck::check::check_fn::hd588b519b8e4dff0ViW
  28:     0x7f2de0f55c90 - middle::typeck::check::check_bare_fn::h62e026ad7d690a0da8V
  29:     0x7f2de0f51d90 - middle::typeck::check::check_item::hd44c3c50a5dfb9a2jsW
  30:     0x7f2de0f55a40 - middle::typeck::check::check_item_types::h81b3d7ebec550ce0k7V
  31:     0x7f2de0a73130 - util::common::time::h1019099971939974795
  32:     0x7f2de1272390 - middle::typeck::check_crate::h0ed70082c7a4b6f2hup
  33:     0x7f2de12d5c30 - driver::driver::phase_3_run_analysis_passes::h8e79204e3159e776IdC
  34:     0x7f2de12d0c70 - driver::driver::compile_input::hf4591f6ef7b02566tUB
  35:     0x7f2de1350e40 - driver::run_compiler::h8547738c3b140275KKF
  36:     0x7f2de1350d30 - driver::run::closure.146360
  37:     0x7f2de0a8b9e0 - task::TaskBuilder<S>::try_future::closure.104798
  38:     0x7f2de0a8b7d0 - task::TaskBuilder<S>::spawn_internal::closure.104769
  39:     0x7f2de0a543d0 - task::NativeSpawner.Spawner::spawn::closure.2582
  40:     0x7f2de2525c40 - rust_try_inner
  41:     0x7f2de2525c30 - rust_try
  42:     0x7f2de2523230 - unwind::try::h242542d3bd53ca70mYc
  43:     0x7f2de25230d0 - task::Task::run::h5e3f75748e9fc0b3u4b
  44:     0x7f2de0a54110 - task::NativeSpawner.Spawner::spawn::closure.2508
  45:     0x7f2de2524240 - thread::thread_start::heed63dda248c44e2rpc
  46:     0x7f2de02a1dc0 - start_thread
  47:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions