Skip to content

Commit b641e9e

Browse files
Make Visitor::visit_body take a simple Body
1 parent 285519d commit b641e9e

File tree

19 files changed

+29
-30
lines changed

19 files changed

+29
-30
lines changed

src/librustc/mir/visit.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ use rustc_span::Span;
6565
// variant argument) that does not require visiting, as in
6666
// `is_cleanup` above.
6767

68-
macro_rules! body_cache_type {
69-
(mut $a:lifetime, $tcx:lifetime) => {
68+
macro_rules! body_type {
69+
(mut $tcx:lifetime) => {
7070
&mut BodyAndCache<$tcx>
7171
};
72-
($a:lifetime, $tcx:lifetime) => {
73-
ReadOnlyBodyAndCache<$a, $tcx>
72+
($tcx:lifetime) => {
73+
&Body<$tcx>
7474
};
7575
}
7676

@@ -82,7 +82,7 @@ macro_rules! make_mir_visitor {
8282

8383
fn visit_body(
8484
&mut self,
85-
body: body_cache_type!($($mutability)? '_, 'tcx)
85+
body: body_type!($($mutability)? 'tcx)
8686
) {
8787
self.super_body(body);
8888
}
@@ -254,7 +254,7 @@ macro_rules! make_mir_visitor {
254254

255255
fn super_body(
256256
&mut self,
257-
$($mutability)? body: body_cache_type!($($mutability)? '_, 'tcx)
257+
$($mutability)? body: body_type!($($mutability)? 'tcx)
258258
) {
259259
let span = body.span;
260260
if let Some(yield_ty) = &$($mutability)? body.yield_ty {
@@ -819,7 +819,7 @@ macro_rules! make_mir_visitor {
819819

820820
fn visit_location(
821821
&mut self,
822-
body: body_cache_type!($($mutability)? '_, 'tcx),
822+
body: body_type!($($mutability)? 'tcx),
823823
location: Location
824824
) {
825825
let basic_block = & $($mutability)? body[location.block];

src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
2020
let mir = fx.mir;
2121
let mut analyzer = LocalAnalyzer::new(fx);
2222

23-
analyzer.visit_body(mir);
23+
analyzer.visit_body(*mir);
2424

2525
for (local, decl) in mir.local_decls.iter_enumerated() {
2626
let ty = fx.monomorphize(&decl.ty);

src/librustc_mir/borrow_check/borrow_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl LocalsStateAtExit {
107107
LocalsStateAtExit::AllAreInvalidated
108108
} else {
109109
let mut has_storage_dead = HasStorageDead(BitSet::new_empty(body.local_decls.len()));
110-
has_storage_dead.visit_body(body);
110+
has_storage_dead.visit_body(*body);
111111
let mut has_storage_dead_or_moved = has_storage_dead.0;
112112
for move_out in &move_data.moves {
113113
if let Some(index) = move_data.base_local(move_out.path) {

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15611561
}
15621562
}
15631563
let mut visitor = FakeReadCauseFinder { place, cause: None };
1564-
visitor.visit_body(self.body);
1564+
visitor.visit_body(*self.body);
15651565
match visitor.cause {
15661566
Some(FakeReadCause::ForMatchGuard) => Some("match guard"),
15671567
Some(FakeReadCause::ForIndex) => Some("indexing expression"),

src/librustc_mir/borrow_check/invalidation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(super) fn generate_invalidates<'tcx>(
3737
body: &body,
3838
dominators,
3939
};
40-
ig.visit_body(body);
40+
ig.visit_body(*body);
4141
}
4242
}
4343

src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl LocalUseMap {
8181
live_locals.iter().for_each(|&local| locals_with_use_data[local] = true);
8282

8383
LocalUseMapBuild { local_use_map: &mut local_use_map, elements, locals_with_use_data }
84-
.visit_body(body);
84+
.visit_body(*body);
8585

8686
local_use_map
8787
}

src/librustc_mir/borrow_check/type_check/liveness/polonius.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub(super) fn populate_access_facts(
101101
location_table,
102102
move_data,
103103
};
104-
extractor.visit_body(body);
104+
extractor.visit_body(*body);
105105

106106
facts.var_dropped_at.extend(
107107
dropped_at.iter().map(|&(local, location)| (local, location_table.mid_index(location))),

src/librustc_mir/borrow_check/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn type_check_internal<'a, 'tcx, R>(
210210
);
211211
let errors_reported = {
212212
let mut verifier = TypeVerifier::new(&mut checker, *body, promoted);
213-
verifier.visit_body(body);
213+
verifier.visit_body(*body);
214214
verifier.errors_reported
215215
};
216216

@@ -435,7 +435,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
435435
}
436436
}
437437

438-
fn visit_body(&mut self, body: ReadOnlyBodyAndCache<'_, 'tcx>) {
438+
fn visit_body(&mut self, body: &Body<'tcx>) {
439439
self.sanitize_type(&"return type", body.return_ty());
440440
for local_decl in &body.local_decls {
441441
self.sanitize_type(local_decl, local_decl.ty);
@@ -563,7 +563,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
563563

564564
swap_constraints(self);
565565

566-
self.visit_body(promoted_body);
566+
self.visit_body(*promoted_body);
567567

568568
if !self.errors_reported {
569569
// if verifier failed, don't do further checks to avoid ICEs

src/librustc_mir/borrow_check/used_muts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
3232
never_initialized_mut_locals: &mut never_initialized_mut_locals,
3333
mbcx: self,
3434
};
35-
visitor.visit_body(visitor.mbcx.body);
35+
visitor.visit_body(*visitor.mbcx.body);
3636
}
3737

3838
// Take the union of the existed `used_mut` set with those variables we've found were

src/librustc_mir/dataflow/impls/storage_liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> {
250250
/// Kill locals that are fully moved and have not been borrowed.
251251
fn check_for_move(&self, trans: &mut impl GenKill<Local>, loc: Location) {
252252
let mut visitor = MoveVisitor { trans, borrowed_locals: &self.borrowed_locals };
253-
visitor.visit_location(self.body, loc);
253+
visitor.visit_location(*self.body, loc);
254254
}
255255
}
256256

0 commit comments

Comments
 (0)