diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-03-28 14:54:41 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-03-29 13:30:26 -0700 |
| commit | 538cdef64ba0087ff1d1c26d7fe1eae099c4d7e5 (patch) | |
| tree | 8de9b1283a1f1ed5148a428102f6e8bca788f5ee | |
| parent | b641e9e3588f78cbef1631b64c20c6ad06734624 (diff) | |
| download | rust-538cdef64ba0087ff1d1c26d7fe1eae099c4d7e5.tar.gz rust-538cdef64ba0087ff1d1c26d7fe1eae099c4d7e5.zip | |
Use `&` to do deref coercion for `ReadOnlyBodyAndCache`
19 files changed, 22 insertions, 22 deletions
diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index a3d68c4d53d..5cbeea82512 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -20,7 +20,7 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let mir = fx.mir; let mut analyzer = LocalAnalyzer::new(fx); - analyzer.visit_body(*mir); + analyzer.visit_body(&mir); for (local, decl) in mir.local_decls.iter_enumerated() { let ty = fx.monomorphize(&decl.ty); diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 5216326a276..919d3f2ab32 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -107,7 +107,7 @@ impl LocalsStateAtExit { LocalsStateAtExit::AllAreInvalidated } else { let mut has_storage_dead = HasStorageDead(BitSet::new_empty(body.local_decls.len())); - has_storage_dead.visit_body(*body); + has_storage_dead.visit_body(&body); let mut has_storage_dead_or_moved = has_storage_dead.0; for move_out in &move_data.moves { if let Some(index) = move_data.base_local(move_out.path) { diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 8e0b4426991..e343fba329b 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -1561,7 +1561,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } } let mut visitor = FakeReadCauseFinder { place, cause: None }; - visitor.visit_body(*self.body); + visitor.visit_body(&self.body); match visitor.cause { Some(FakeReadCause::ForMatchGuard) => Some("match guard"), Some(FakeReadCause::ForIndex) => Some("indexing expression"), diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs index 741192323fe..653578cc156 100644 --- a/src/librustc_mir/borrow_check/invalidation.rs +++ b/src/librustc_mir/borrow_check/invalidation.rs @@ -37,7 +37,7 @@ pub(super) fn generate_invalidates<'tcx>( body: &body, dominators, }; - ig.visit_body(*body); + ig.visit_body(&body); } } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index e3dc9e0f105..b6c3ae0fb87 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -299,8 +299,8 @@ fn do_mir_borrowck<'a, 'tcx>( } dataflow::visit_results( - &*body, - traversal::reverse_postorder(&*body).map(|(bb, _)| bb), + &body, + traversal::reverse_postorder(&body).map(|(bb, _)| bb), &results, &mut mbcx, ); diff --git a/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs index 6738bb48337..9a4eeb8ffc4 100644 --- a/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs @@ -81,7 +81,7 @@ impl LocalUseMap { live_locals.iter().for_each(|&local| locals_with_use_data[local] = true); LocalUseMapBuild { local_use_map: &mut local_use_map, elements, locals_with_use_data } - .visit_body(*body); + .visit_body(&body); local_use_map } diff --git a/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs b/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs index ddced3f355e..9bb1bbeaf00 100644 --- a/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs +++ b/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs @@ -101,7 +101,7 @@ pub(super) fn populate_access_facts( location_table, move_data, }; - extractor.visit_body(*body); + extractor.visit_body(&body); facts.var_dropped_at.extend( dropped_at.iter().map(|&(local, location)| (local, location_table.mid_index(location))), diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index 3a0b908332f..b8dd1010b4c 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -210,7 +210,7 @@ fn type_check_internal<'a, 'tcx, R>( ); let errors_reported = { let mut verifier = TypeVerifier::new(&mut checker, *body, promoted); - verifier.visit_body(*body); + verifier.visit_body(&body); verifier.errors_reported }; @@ -563,7 +563,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { swap_constraints(self); - self.visit_body(*promoted_body); + self.visit_body(&promoted_body); if !self.errors_reported { // if verifier failed, don't do further checks to avoid ICEs diff --git a/src/librustc_mir/borrow_check/used_muts.rs b/src/librustc_mir/borrow_check/used_muts.rs index d4f54d927a7..7fbf8842860 100644 --- a/src/librustc_mir/borrow_check/used_muts.rs +++ b/src/librustc_mir/borrow_check/used_muts.rs @@ -32,7 +32,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { never_initialized_mut_locals: &mut never_initialized_mut_locals, mbcx: self, }; - visitor.visit_body(*visitor.mbcx.body); + visitor.visit_body(&visitor.mbcx.body); } // Take the union of the existed `used_mut` set with those variables we've found were diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index ffbff00cf37..b0ef539d96b 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -307,7 +307,7 @@ pub fn const_eval_raw_provider<'tcx>( ); let res = ecx.load_mir(cid.instance.def, cid.promoted); - res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, *body)) + res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, &body)) .and_then(|place| { Ok(RawConst { alloc_id: place.ptr.assert_ptr().alloc_id, ty: place.layout.ty }) }) diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index 30aef7f6919..1d18279938b 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -83,7 +83,7 @@ impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> { ) -> Self { MaybeRequiresStorage { body, - borrowed_locals: RefCell::new(ResultsRefCursor::new(*body, borrowed_locals)), + borrowed_locals: RefCell::new(ResultsRefCursor::new(&body, borrowed_locals)), } } } @@ -250,7 +250,7 @@ impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> { /// Kill locals that are fully moved and have not been borrowed. fn check_for_move(&self, trans: &mut impl GenKill<Local>, loc: Location) { let mut visitor = MoveVisitor { trans, borrowed_locals: &self.borrowed_locals }; - visitor.visit_location(*self.body, loc); + visitor.visit_location(&self.body, loc); } } diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 69ad8471f7b..e42cff02699 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1162,7 +1162,7 @@ fn collect_neighbours<'tcx>( debug!("collect_neighbours: {:?}", instance.def_id()); let body = tcx.instance_mir(instance.def); - MirNeighborCollector { tcx, body: &body, output, instance }.visit_body(*body); + MirNeighborCollector { tcx, body: &body, output, instance }.visit_body(&body); } fn def_id_to_string(tcx: TyCtxt<'_>, def_id: DefId) -> String { diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 1c812bd8520..99c3437bf69 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -183,7 +183,7 @@ impl Validator<'a, 'mir, 'tcx> { self.check_op_spanned(ops::Loop, body.span); } - self.visit_body(*body); + self.visit_body(&body); // Ensure that the end result is `Sync` in a non-thread local `static`. let should_check_for_sync = diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 6ddd72d7436..546361d62f4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -507,7 +507,7 @@ fn unsafety_check_result(tcx: TyCtxt<'_>, def_id: DefId) -> UnsafetyCheckResult // mir_built ensures that body has a computed cache, so we don't (and can't) attempt to // recompute it here. let body = body.unwrap_read_only(); - checker.visit_body(*body); + checker.visit_body(&body); check_unused_unsafe(tcx, def_id, &checker.used_unsafe, &mut checker.inherited_blocks); UnsafetyCheckResult { diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 0dc8e93d6b5..e17d1cf63d5 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -778,7 +778,7 @@ impl CanConstProp { trace!("local {:?} can't be const propagated because it's not a temporary", local); } } - cpv.visit_body(*body); + cpv.visit_body(&body); cpv.can_const_prop } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 699f386c41c..030df37827f 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -469,7 +469,7 @@ fn locals_live_across_suspend_points( // Find the MIR locals which do not use StorageLive/StorageDead statements. // The storage of these locals are always live. let mut ignored = StorageIgnored(BitSet::new_filled(body.local_decls.len())); - ignored.visit_body(*body); + ignored.visit_body(&body); // Calculate the MIR locals which have been previously // borrowed (even if they are still active). diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index e0415e4954e..bb556f40387 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -26,7 +26,7 @@ impl<'tcx> MirPass<'tcx> for InstCombine { let optimizations = { let read_only_cache = read_only!(body); let mut optimization_finder = OptimizationFinder::new(body, tcx); - optimization_finder.visit_body(*read_only_cache); + optimization_finder.visit_body(&read_only_cache); optimization_finder.optimizations }; diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 5194fb599bc..55ea1e40e08 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -309,7 +309,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals { let locals = { let read_only_cache = read_only!(body); let mut marker = DeclMarker { locals: BitSet::new_empty(body.local_decls.len()), body }; - marker.visit_body(*read_only_cache); + marker.visit_body(&read_only_cache); // Return pointer and arguments are always live marker.locals.insert(RETURN_PLACE); for arg in body.args_iter() { diff --git a/src/librustc_mir/util/def_use.rs b/src/librustc_mir/util/def_use.rs index 44aaf401fd4..059cea86a4d 100644 --- a/src/librustc_mir/util/def_use.rs +++ b/src/librustc_mir/util/def_use.rs @@ -38,7 +38,7 @@ impl DefUseAnalysis { var_debug_info_index: 0, in_var_debug_info: false, }; - finder.visit_body(*body); + finder.visit_body(&body); self.info = finder.info } |
