From c5829c2ee544eb9931ce0d34f46b113b0a1e7f04 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 6 Mar 2023 16:36:42 +0000 Subject: [PATCH] Fix new usage of old api --- .../rustc_mir_build/src/build/custom/parse/instruction.rs | 4 ++-- compiler/rustc_mir_build/src/build/scope.rs | 4 ++-- compiler/rustc_mir_transform/src/elaborate_drops.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index 33b73928704..54028dfe87b 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -56,7 +56,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { Ok(TerminatorKind::Drop { place: self.parse_place(args[0])?, target: self.parse_block(args[1])?, - unwind: None, + unwind: UnwindAction::Continue, }) }, @call("mir_call", args) => { @@ -126,7 +126,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { args, destination, target: Some(target), - cleanup: None, + unwind: UnwindAction::Continue, from_hir_call: *from_hir_call, fn_span: *fn_span, }) diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index 2c401405f92..f32d2db4e71 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -1438,11 +1438,11 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind { let term = &mut cfg.block_data_mut(from).terminator_mut(); match &mut term.kind { TerminatorKind::Drop { unwind, .. } => { - if let Some(unwind) = *unwind { + if let UnwindAction::Cleanup(unwind) = *unwind { let source_info = term.source_info; cfg.terminate(unwind, source_info, TerminatorKind::Goto { target: to }); } else { - *unwind = Some(to); + *unwind = UnwindAction::Cleanup(to); } } TerminatorKind::FalseUnwind { unwind, .. } diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index dd7fd2524e0..a702113bd99 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -160,7 +160,7 @@ fn remove_dead_unwinds<'tcx>( let basic_blocks = body.basic_blocks.as_mut(); for &bb in dead_unwinds.iter() { if let Some(unwind) = basic_blocks[bb].terminator_mut().unwind_mut() { - *unwind = None; + *unwind = UnwindAction::Unreachable; } } }