Place::iterate do not take an accumulator anymore, hide that in a private fn
This commit is contained in:
parent
53fa32fe50
commit
0326f0a803
2 changed files with 10 additions and 3 deletions
|
|
@ -2062,12 +2062,19 @@ impl<'tcx> Place<'tcx> {
|
|||
/// Recursively "iterates" over place components, generating a `PlaceComponents` list,
|
||||
/// invoking `op` with a `PlaceComponentsIter`.
|
||||
pub fn iterate<R>(
|
||||
&self,
|
||||
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
|
||||
) -> R {
|
||||
self.iterate2(None, op)
|
||||
}
|
||||
|
||||
fn iterate2<R>(
|
||||
&self,
|
||||
next: Option<&PlaceComponents<'_, 'tcx>>,
|
||||
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
|
||||
) -> R {
|
||||
match self {
|
||||
Place::Projection(interior) => interior.base.iterate(
|
||||
Place::Projection(interior) => interior.base.iterate2(
|
||||
Some(&PlaceComponents {
|
||||
component: self,
|
||||
next,
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
borrow_place.iterate(None, |borrow_components| {
|
||||
access_place.iterate(None, |access_components| {
|
||||
borrow_place.iterate(|borrow_components| {
|
||||
access_place.iterate(|access_components| {
|
||||
place_components_conflict(
|
||||
tcx,
|
||||
mir,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue