Skip to content

Commit 0326f0a

Browse files
committed
Place::iterate do not take an accumulator anymore, hide that in a private fn
1 parent 53fa32f commit 0326f0a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustc/mir/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,12 +2062,19 @@ impl<'tcx> Place<'tcx> {
20622062
/// Recursively "iterates" over place components, generating a `PlaceComponents` list,
20632063
/// invoking `op` with a `PlaceComponentsIter`.
20642064
pub fn iterate<R>(
2065+
&self,
2066+
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
2067+
) -> R {
2068+
self.iterate2(None, op)
2069+
}
2070+
2071+
fn iterate2<R>(
20652072
&self,
20662073
next: Option<&PlaceComponents<'_, 'tcx>>,
20672074
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
20682075
) -> R {
20692076
match self {
2070-
Place::Projection(interior) => interior.base.iterate(
2077+
Place::Projection(interior) => interior.base.iterate2(
20712078
Some(&PlaceComponents {
20722079
component: self,
20732080
next,

src/librustc_mir/borrow_check/places_conflict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>(
6767
}
6868
}
6969

70-
borrow_place.iterate(None, |borrow_components| {
71-
access_place.iterate(None, |access_components| {
70+
borrow_place.iterate(|borrow_components| {
71+
access_place.iterate(|access_components| {
7272
place_components_conflict(
7373
tcx,
7474
mir,

0 commit comments

Comments
 (0)