Skip to content

Commit 4cba9f0

Browse files
committed
Auto merge of #68462 - matthiaskrgr:novec, r=<try>
librustc_mir: don't allocate vectors where slices will do.
2 parents f5abfb1 + 71370c8 commit 4cba9f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/librustc_mir/transform/generator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor<'tcx> {
117117
place,
118118
Place {
119119
local: self_arg(),
120-
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Deref]),
120+
projection: self.tcx().intern_place_elems(&[ProjectionElem::Deref]),
121121
},
122122
self.tcx,
123123
);
@@ -153,7 +153,7 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> {
153153
place,
154154
Place {
155155
local: self_arg(),
156-
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Field(
156+
projection: self.tcx().intern_place_elems(&[ProjectionElem::Field(
157157
Field::new(0),
158158
self.ref_gen_ty,
159159
)]),

src/librustc_mir/transform/instcombine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> {
5151
let new_place = match rvalue {
5252
Rvalue::Ref(_, _, place) => {
5353
if let &[ref proj_l @ .., proj_r] = place.projection.as_ref() {
54-
place.projection = self.tcx().intern_place_elems(&vec![proj_r.clone()]);
54+
place.projection = self.tcx().intern_place_elems(&[proj_r.clone()]);
5555

5656
Place {
5757
// Replace with dummy

0 commit comments

Comments
 (0)