Skip to content

Commit 7b65fe8

Browse files
csmoespastorino
authored andcommitted
remove inefficient split_projection
1 parent 5766076 commit 7b65fe8

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

src/librustc/mir/tcx.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -284,50 +284,9 @@ impl<'tcx> NeoPlace<'tcx> {
284284
}
285285
}
286286

287-
// for Place:
288-
// (Base.[a, b, c])
289-
// ^^^^^^^^^^ ^-- projection
290-
// |-- base_place
291-
//
292-
// Base.[]
293-
// ^^^^ ^^-- no projection(empty)
294-
// |-- base_place
295-
pub fn split_projection<'cx, 'gcx>(
296-
&self,
297-
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
298-
) -> (NeoPlace<'tcx>, Option<&'tcx PlaceElem<'tcx>>) {
299-
// split place_elems
300-
// Base.[a, b, c]
301-
// ^^^^ ^-- projection(projection lives in the last elem)
302-
// |-- place_elems
303-
match self.elems.split_last() {
304-
Some((projection, place_elems)) => (
305-
NeoPlace {
306-
base: self.clone().base,
307-
elems: tcx.intern_place_elems(place_elems),
308-
},
309-
Some(projection),
310-
),
311-
_ => (self.clone(), None)
312-
}
313-
}
314-
315287
pub fn has_no_projection(&self) -> bool {
316288
self.elems.is_empty()
317289
}
318-
319-
// for projection returns the base place;
320-
// Base.[a, b, c] => Base.[a, b]
321-
// ^-- projection
322-
// if no projection returns the place itself,
323-
// Base.[] => Base.[]
324-
// ^^-- no projection
325-
pub fn projection_base<'cx, 'gcx>(&self, tcx: TyCtxt<'cx, 'gcx, 'tcx>) -> NeoPlace<'tcx> {
326-
match self.split_projection(tcx) {
327-
(place, Some(_)) => place,
328-
(_, None) => self.clone(),
329-
}
330-
}
331290
}
332291

333292
pub enum RvalueInitializationState {

0 commit comments

Comments
 (0)