1
Fork 0

make_integrate_local takes Local by value

This commit is contained in:
Santiago Pastorino 2020-01-14 01:26:11 -03:00
parent 4a86c55f56
commit 10b19f6dee
No known key found for this signature in database
GPG key ID: 88C941CDA1D46432

View file

@ -640,8 +640,8 @@ impl<'a, 'tcx> Integrator<'a, 'tcx> {
new new
} }
fn make_integrate_local(&self, local: &Local) -> Local { fn make_integrate_local(&self, local: Local) -> Local {
if *local == RETURN_PLACE { if local == RETURN_PLACE {
return self.destination.local; return self.destination.local;
} }
@ -660,7 +660,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
} }
fn visit_local(&mut self, local: &mut Local, _ctxt: PlaceContext, _location: Location) { fn visit_local(&mut self, local: &mut Local, _ctxt: PlaceContext, _location: Location) {
*local = self.make_integrate_local(local); *local = self.make_integrate_local(*local);
} }
fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) { fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) {
@ -680,7 +680,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
fn process_projection_elem(&mut self, elem: &PlaceElem<'tcx>) -> Option<PlaceElem<'tcx>> { fn process_projection_elem(&mut self, elem: &PlaceElem<'tcx>) -> Option<PlaceElem<'tcx>> {
if let PlaceElem::Index(local) = elem { if let PlaceElem::Index(local) = elem {
let new_local = self.make_integrate_local(local); let new_local = self.make_integrate_local(*local);
if new_local != *local { if new_local != *local {
return Some(PlaceElem::Index(new_local)); return Some(PlaceElem::Index(new_local));