Skip to content

Commit b1dbe6f

Browse files
committed
Intern PlaceElem with iterator
1 parent 6002649 commit b1dbe6f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/librustc/mir/mod.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,17 +1840,6 @@ impl<'a, 'tcx> Place<'tcx> {
18401840
})
18411841
}
18421842

1843-
pub fn elem(
1844-
self,
1845-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
1846-
elem: PlaceElem<'tcx>,
1847-
) -> Self {
1848-
Place {
1849-
base: self.base,
1850-
elems: tcx.intern_place_elems(&[elem]),
1851-
}
1852-
}
1853-
18541843
pub fn local(local: Local) -> Self {
18551844
Place {
18561845
base: PlaceBase::Local(local),
@@ -1874,6 +1863,19 @@ impl<'a, 'tcx> Place<'tcx> {
18741863
elems: Slice::empty(),
18751864
}
18761865
}
1866+
1867+
fn elem(
1868+
self,
1869+
tcx: TyCtxt<'_, '_, 'tcx>,
1870+
elem: PlaceElem<'tcx>,
1871+
) -> Self {
1872+
Place {
1873+
base: self.base,
1874+
elems: tcx.mk_place_elems(
1875+
self.elems.iter().cloned().chain(iter::once(elem))
1876+
),
1877+
}
1878+
}
18771879
}
18781880

18791881
impl<'tcx> Debug for PlaceBase<'tcx> {

0 commit comments

Comments
 (0)