Skip to content

Commit 3460115

Browse files
committed
Allow elaborate_drops to progress under errors that come up during borrowck=migrate.
1 parent ff2f9e0 commit 3460115

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/librustc_mir/transform/elaborate_drops.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,20 @@ impl MirPass for ElaborateDrops {
4141

4242
let id = tcx.hir.as_local_node_id(src.def_id).unwrap();
4343
let param_env = tcx.param_env(src.def_id).with_reveal_all();
44-
let move_data = MoveData::gather_moves(mir, tcx).unwrap();
44+
let move_data = match MoveData::gather_moves(mir, tcx) {
45+
Ok(move_data) => move_data,
46+
Err((move_data, _move_errors)) => {
47+
// The only way we should be allowing any move_errors
48+
// in here is if we are in the migration path for the
49+
// NLL-based MIR-borrowck.
50+
//
51+
// If we are in the migration path, we have already
52+
// reported these errors as warnings to the user. So
53+
// we will just ignore them here.
54+
assert!(tcx.migrate_borrowck());
55+
move_data
56+
}
57+
};
4558
let elaborate_patch = {
4659
let mir = &*mir;
4760
let env = MoveDataParamEnv {

0 commit comments

Comments
 (0)