Skip to content

ICE on branch to a proc with unspecified type & a proc with a reference arg #14039

Closed
@huonw

Description

@huonw
fn main() {
    if true {
        proc(_) {}
    } else {
        proc(_: &mut ()) {}
    };
}
ice4.rs:2:5: 6:6 error: internal compiler error: Region ReInfer(ReVar(middle::ty::RegionVid{id: 0u})) is not associated with any bound region from A!
ice4.rs:2     if true {
ice4.rs:3         proc(_) {}
ice4.rs:4     } else {
ice4.rs:5         proc(_: &mut ()) {}
ice4.rs:6     };
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:99
stack backtrace:
   1:     0x7f3393a36240 - rt::backtrace::imp::write::h47fe109ac3049adffza::v0.11.pre
   2:     0x7f33939875d0 - rt::unwind::begin_unwind_inner::h6061c949133dceeek99::v0.11.pre
   3:     0x7f339280b9b0 - rt::unwind::begin_unwind::h11314483157330216575::v0.11.pre
   4:     0x7f339280b8e0 - diagnostic::SpanHandler::span_bug::hc71aee6f66413044vVb::v0.11.pre
   5:     0x7f339467b8b0 - driver::session::Session::span_bug::h17bfdebff4803efeFrj::v0.11.pre
   6:     0x7f339495e2a0 - middle::typeck::infer::lub::Lub<'f>.Combine::fn_sigs::closure.69969
   7:     0x7f33947ecbe0 - middle::ty_fold::RegionFolder<'a>.TypeFolder::fold_region::he78d5a8045217274d3Q::v0.11.pre
   8:     0x7f33947ec190 - middle::ty_fold::super_fold_sty::h10671660021486755198::v0.11.pre
   9:     0x7f33947ae420 - middle::ty_fold::RegionFolder<'a>.TypeFolder::fold_ty::h8fffe33fee97bcfbW0Q::v0.11.pre
  10:     0x7f33947af510 - iter::Iterator::collect::h14491155447903276746::v0.11.pre
  11:     0x7f339495d580 - middle::typeck::infer::lub::Lub<'f>.Combine::fn_sigs::h2276d0f53c9cc88doDi::v0.11.pre
  12:     0x7f3394967050 - middle::typeck::infer::combine::Combine::closure_tys::h7918828032888759876::v0.11.pre
  13:     0x7f339495fc30 - middle::typeck::infer::lattice::super_lattice_tys::h421177317821972521::v0.11.pre
  14:     0x7f33949b4cc0 - middle::typeck::infer::common_supertype::closure.71236
  15:     0x7f33949b4c80 - middle::typeck::infer::InferCtxt<'a>::commit::closure.71230
  16:     0x7f339494a320 - middle::typeck::infer::InferCtxt<'a>::try::h5526458837193382813::v0.11.pre
  17:     0x7f33949b4af0 - middle::typeck::infer::InferCtxt<'a>::commit::closure.71228
  18:     0x7f33949b3fc0 - util::common::indent::h12816111372132265695::v0.11.pre
  19:     0x7f33949b3d80 - middle::typeck::infer::InferCtxt<'a>::commit::h3309691450176933472::v0.11.pre
  20:     0x7f339486f5d0 - middle::typeck::infer::common_supertype::h574a799d34a9701eSHp::v0.11.pre
  21:     0x7f3394918e50 - middle::typeck::check::check_expr_with_unifier::h13eff655c3f9c371Dya::v0.11.pre
  22:     0x7f3394937b50 - middle::typeck::check::check_stmt::hba22b91edb52e891FTc::v0.11.pre
  23:     0x7f33948f8730 - middle::typeck::check::check_block_with_expected::h2bcfbea132dff995CXc::v0.11.pre
  24:     0x7f33948f3800 - middle::typeck::check::check_fn::h015b2d4e9926e649Ll8::v0.11.pre
  25:     0x7f33948f35a0 - middle::typeck::check::check_bare_fn::h276d49bccf79d6cbib8::v0.11.pre
  26:     0x7f33948eb3e0 - middle::typeck::check::check_item::hf4303c618e67640ejI8::v0.11.pre
  27:     0x7f33948f33a0 - middle::typeck::check::check_item_types::h3a12f8481de3c645Aa8::v0.11.pre
  28:     0x7f3394a3fe70 - util::common::time::h14771813586294062655::v0.11.pre
  29:     0x7f3394a3ebd0 - middle::typeck::check_crate::ha64d37049d8764a6L7v::v0.11.pre
  30:     0x7f3394e6a1d0 - driver::driver::phase_3_run_analysis_passes::hfcc0f62a0837a3f1ZDh::v0.11.pre
  31:     0x7f3394e6fa80 - driver::driver::compile_input::h109dae099456ee6aO3h::v0.11.pre
  32:     0x7f3394e94da0 - run_compiler::h05fa0a47a6b6f28bzwp::v0.11.pre
  33:     0x7f3394eb13d0 - main_args::closure.93793
  34:     0x7f3394eaf8d0 - monitor::closure.93668
  35:     0x7f3394eaa090 - task::TaskBuilder::try::closure.93434
  36:     0x7f33940d10b0 - task::spawn_opts::closure.7161
  37:     0x7f3393a2bc70 - rt::task::Task::run::closure.40355
  38:     0x7f3393a3c5b0 - rust_try
  39:     0x7f3393a2bab0 - rt::task::Task::run::hf886fab2982b08c7nZ7::v0.11.pre
  40:     0x7f33940d0e80 - task::spawn_opts::closure.7134
  41:     0x7f3393a34d80 - rt::thread::thread_start::h7d20e7f4bce06592AE8::v0.11.pre
  42:     0x7f3391710fa0 - start_thread
  43:     0x7f339365ba09 - __clone
  44:                0x0 - <unknown>

Swapping the order of the branches compiles fine.

cc @nikomatsakis @pnkfelix

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions