Auto merge of #70449 - ecstatic-morse:visit-body, r=oli-obk

Make `Visitor::visit_body` take a plain `&Body`

`ReadOnlyBodyAndCache` has replaced `&Body` in many parts of the code base that don't care about basic block predecessors. This includes the MIR `Visitor` trait, which I suspect resulted in many unnecessary changes in #64736. This reverts part of that PR to reduce the number of places where we need to pass a `ReadOnlyBodyAndCache`.

In the long term, we should either give `ReadOnlyBodyAndCache` more ergonomic name and replace all uses of `&mir::Body` with it at the cost of carrying an extra pointer everywhere, or use it only in places that actually need access to the predecessor cache. Perhaps there is an even nicer alternative.

r? @Nashenas88
This commit is contained in:
bors 2020-03-30 02:04:00 +00:00
commit 0afdf43dc1
21 changed files with 33 additions and 34 deletions

View file

@ -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);