Skip to content

Commit

Permalink
librustc_mir: don't allocate vectors where slices will do.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jan 22, 2020
1 parent f5abfb1 commit 71370c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/generator.rs
Expand Up @@ -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,
);
Expand Down Expand Up @@ -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,
)]),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/instcombine.rs
Expand Up @@ -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
Expand Down

0 comments on commit 71370c8

Please sign in to comment.