diff options
| author | bors <bors@rust-lang.org> | 2022-07-29 07:11:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-29 07:11:50 +0000 |
| commit | 7dfdd64433b07239fbac50b8227b6e03a0ba8f30 (patch) | |
| tree | e8e6a57c31f957d3df90aac8cc738c772e75b791 /compiler/rustc_mir_transform/src | |
| parent | ea6ab1bd845790fb31ba790d2c7aec898f89fe62 (diff) | |
| parent | bd24b4006c98425aa994763acf7f7e18607c7df1 (diff) | |
| download | rust-7dfdd64433b07239fbac50b8227b6e03a0ba8f30.tar.gz rust-7dfdd64433b07239fbac50b8227b6e03a0ba8f30.zip | |
Auto merge of #99667 - ouz-a:some_branch, r=oli-obk
Optimize `UnDerefer` Addresses the performance [issues](https://github.com/rust-lang/rust/pull/98145#issuecomment-1183548597) faced here. r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/elaborate_drops.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/remove_uninit_drops.rs | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index 71ab6dee1b6..9c1fcbaa69d 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -28,20 +28,19 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { debug!("elaborate_drops({:?} @ {:?})", body.source, body.span); - let mut un_derefer = UnDerefer { tcx: tcx, derefer_sidetable: Default::default() }; - un_derefer.ref_finder(body); let def_id = body.source.def_id(); let param_env = tcx.param_env_reveal_all_normalized(def_id); - let move_data = match MoveData::gather_moves(body, tcx, param_env) { + let (side_table, move_data) = match MoveData::gather_moves(body, tcx, param_env) { Ok(move_data) => move_data, Err((move_data, _)) => { tcx.sess.delay_span_bug( body.span, "No `move_errors` should be allowed in MIR borrowck", ); - move_data + (Default::default(), move_data) } }; + let un_derefer = UnDerefer { tcx: tcx, derefer_sidetable: side_table }; let elaborate_patch = { let body = &*body; let env = MoveDataParamEnv { move_data, param_env }; diff --git a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs index c48aa9a90ef..96b715402e7 100644 --- a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs +++ b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs @@ -21,7 +21,7 @@ pub struct RemoveUninitDrops; impl<'tcx> MirPass<'tcx> for RemoveUninitDrops { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let param_env = tcx.param_env(body.source.def_id()); - let Ok(move_data) = MoveData::gather_moves(body, tcx, param_env) else { + let Ok((_,move_data)) = MoveData::gather_moves(body, tcx, param_env) else { // We could continue if there are move errors, but there's not much point since our // init data isn't complete. return; |
