Allow elaborate_drops to progress under errors that come up during borrowck=migrate.

This commit is contained in:
Felix S. Klock II 2018-07-25 01:31:40 +02:00
parent ff2f9e0234
commit 3460115157
1 changed files with 14 additions and 1 deletions

View File

@ -41,7 +41,20 @@ impl MirPass for ElaborateDrops {
let id = tcx.hir.as_local_node_id(src.def_id).unwrap();
let param_env = tcx.param_env(src.def_id).with_reveal_all();
let move_data = MoveData::gather_moves(mir, tcx).unwrap();
let move_data = match MoveData::gather_moves(mir, tcx) {
Ok(move_data) => move_data,
Err((move_data, _move_errors)) => {
// The only way we should be allowing any move_errors
// in here is if we are in the migration path for the
// NLL-based MIR-borrowck.
//
// If we are in the migration path, we have already
// reported these errors as warnings to the user. So
// we will just ignore them here.
assert!(tcx.migrate_borrowck());
move_data
}
};
let elaborate_patch = {
let mir = &*mir;
let env = MoveDataParamEnv {