Skip to content

ICE on nightly with -Znll-dump-cause and match on a tuple #47646

Closed
@tanriol

Description

@tanriol

On nightly rustc 2018-01-20 the following code snippet

#![feature(nll)]

use std::collections::BinaryHeap;

fn main() {
    let mut heap: BinaryHeap<i32> = BinaryHeap::new();
    let borrow = heap.peek_mut();

    match (borrow, ()) {
        (Some(_), ()) => {
            println!("{:?}", heap);
        },

        _ => {	}
    };
}

causes an ICE when run as rustc +nightly -Znll-dump-cause src/main.rs (panic in explain_why_borrow_contains_point)

Backtrace
   9: core::panicking::panic
             at libcore/panicking.rs:51
  10: rustc_mir::borrow_check::nll::explain_borrow::<impl rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx>>::explain_why_borrow_contains_point
  11: rustc_mir::borrow_check::error_reporting::<impl rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx>>::report_conflicting_borrow
  12: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
  13: <rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx> as rustc_mir::dataflow::DataflowResultsConsumer<'cx, 'tcx>>::visit_statement_entry
  14: rustc::ty::context::tls::enter
  15: rustc::infer::InferCtxtBuilder::enter
  16: rustc_mir::borrow_check::mir_borrowck
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_borrowck<'tcx>>::compute_result
  18: rustc::dep_graph::graph::DepGraph::with_task_impl
  19: rustc_errors::Handler::track_diagnostics
  20: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  21: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_borrowck<'tcx>>::force
  22: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_borrowck<'tcx>>::try_get
  23: rustc::ty::maps::TyCtxtAt::mir_borrowck
  24: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_borrowck
  25: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::{{closure}}
  26: <std::thread::local::LocalKey<T>>::with
  27: <std::thread::local::LocalKey<T>>::with
  28: rustc::ty::context::TyCtxt::create_and_enter
  29: rustc_driver::driver::compile_input
  30: rustc_driver::run_compiler
`rustc` version details
rustc 1.25.0-nightly (15a1e2844 2018-01-20)
binary: rustc
commit-hash: 15a1e2844dfea7850be5c6c901b67ceff370b0eb
commit-date: 2018-01-20
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️NLL-completeWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions