update formating

This commit is contained in:
Henry Boisdequin 2021-02-16 07:01:55 +05:30
parent eace240ebe
commit 30c5125fbe
2 changed files with 20 additions and 8 deletions

View File

@ -962,7 +962,8 @@ impl<'tcx> LocalDecl<'tcx> {
opt_ty_info: _, opt_ty_info: _,
opt_match_place: _, opt_match_place: _,
pat_span: _, pat_span: _,
}) | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm), })
| BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
))) )))
) )
} }
@ -979,7 +980,8 @@ impl<'tcx> LocalDecl<'tcx> {
opt_ty_info: _, opt_ty_info: _,
opt_match_place: _, opt_match_place: _,
pat_span: _, pat_span: _,
}) | BindingForm::ImplicitSelf(_), })
| BindingForm::ImplicitSelf(_),
))) )))
) )
} }

View File

@ -492,7 +492,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
// Special-case reborrows to be more like a copy of a reference. // Special-case reborrows to be more like a copy of a reference.
match *rvalue { match *rvalue {
Rvalue::Ref(_, kind, place) => { Rvalue::Ref(_, kind, place) => {
if let Some(place_ref) = place_as_reborrow(self.tcx, self.body, place) { if let Some(reborrowed_place_ref) = place_as_reborrow(self.tcx, self.body, place) {
let ctx = match kind { let ctx = match kind {
BorrowKind::Shared => { BorrowKind::Shared => {
PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow) PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow)
@ -507,21 +507,31 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
PlaceContext::MutatingUse(MutatingUseContext::Borrow) PlaceContext::MutatingUse(MutatingUseContext::Borrow)
} }
}; };
self.visit_local(&place.local, ctx, location); self.visit_local(&reborrowed_place_ref.local, ctx, location);
self.visit_projection(place.local, place_ref.projection, ctx, location); self.visit_projection(
reborrowed_place_ref.local,
reborrowed_place_ref.projection,
ctx,
location,
);
return; return;
} }
} }
Rvalue::AddressOf(mutbl, place) => { Rvalue::AddressOf(mutbl, place) => {
if let Some(place_ref) = place_as_reborrow(self.tcx, self.body, place) { if let Some(reborrowed_place_ref) = place_as_reborrow(self.tcx, self.body, place) {
let ctx = match mutbl { let ctx = match mutbl {
Mutability::Not => { Mutability::Not => {
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
} }
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf), Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
}; };
self.visit_local(&place.local, ctx, location); self.visit_local(&reborrowed_place_ref.local, ctx, location);
self.visit_projection(place.local, place_ref.projection, ctx, location); self.visit_projection(
reborrowed_place_ref.local,
reborrowed_place_ref.projection,
ctx,
location,
);
return; return;
} }
} }