librustc_mir: don't allocate vectors where slices will do.

This commit is contained in:
Matthias Krüger 2020-01-22 17:19:26 +01:00
parent f5abfb1569
commit 71370c87f7
2 changed files with 3 additions and 3 deletions

View File

@ -117,7 +117,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor<'tcx> {
place,
Place {
local: self_arg(),
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Deref]),
projection: self.tcx().intern_place_elems(&[ProjectionElem::Deref]),
},
self.tcx,
);
@ -153,7 +153,7 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> {
place,
Place {
local: self_arg(),
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Field(
projection: self.tcx().intern_place_elems(&[ProjectionElem::Field(
Field::new(0),
self.ref_gen_ty,
)]),

View File

@ -51,7 +51,7 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> {
let new_place = match rvalue {
Rvalue::Ref(_, _, place) => {
if let &[ref proj_l @ .., proj_r] = place.projection.as_ref() {
place.projection = self.tcx().intern_place_elems(&vec![proj_r.clone()]);
place.projection = self.tcx().intern_place_elems(&[proj_r.clone()]);
Place {
// Replace with dummy