diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2019-02-27 21:27:50 +0100 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2019-04-17 19:44:17 +0200 |
| commit | 0326f0a80359ec13c4d0716ed6b375506703ba20 (patch) | |
| tree | cf2f5b01836fd4252406bcad7ea6ac4786f75306 | |
| parent | 53fa32fe50e2f9df37f59f061402f131827d5e94 (diff) | |
| download | rust-0326f0a80359ec13c4d0716ed6b375506703ba20.tar.gz rust-0326f0a80359ec13c4d0716ed6b375506703ba20.zip | |
Place::iterate do not take an accumulator anymore, hide that in a private fn
| -rw-r--r-- | src/librustc/mir/mod.rs | 9 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/places_conflict.rs | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 60c7c256ec7..047f338ab67 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2063,11 +2063,18 @@ impl<'tcx> Place<'tcx> { /// 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, diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 45bbbbc92d9..c498d7f7d96 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -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, |
