Skip to content

Commit

Permalink
Place::iterate do not take an accumulator anymore, hide that in a pri…
Browse files Browse the repository at this point in the history
…vate fn
  • Loading branch information
spastorino committed Apr 17, 2019
1 parent 53fa32f commit 0326f0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/librustc/mir/mod.rs
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/borrow_check/places_conflict.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 0326f0a

Please sign in to comment.