Skip to content

Commit 39f6d6b

Browse files
committed
Place::iterate do not take an accumulator anymore, hide that in a private fn
1 parent bd8943c commit 39f6d6b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustc/mir/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -2048,12 +2048,19 @@ impl<'tcx> Place<'tcx> {
20482048
/// Recursively "iterates" over place components, generating a `PlaceComponents` list,
20492049
/// invoking `op` with a `PlaceComponentsIter`.
20502050
pub fn iterate<R>(
2051+
&self,
2052+
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
2053+
) -> R {
2054+
self.iterate2(None, op)
2055+
}
2056+
2057+
fn iterate2<R>(
20512058
&self,
20522059
next: Option<&PlaceComponents<'_, 'tcx>>,
20532060
op: impl FnOnce(PlaceComponentsIter<'_, 'tcx>) -> R,
20542061
) -> R {
20552062
match self {
2056-
Place::Projection(interior) => interior.base.iterate(
2063+
Place::Projection(interior) => interior.base.iterate2(
20572064
Some(&PlaceComponents {
20582065
component: self,
20592066
next,

src/librustc_mir/borrow_check/places_conflict.rs

+2-2
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)