mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-04 14:07:36 +00:00
librustc_mir: don't allocate vectors where slices will do.
This commit is contained in:
parent
f5abfb1569
commit
71370c87f7
@ -117,7 +117,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor<'tcx> {
|
|||||||
place,
|
place,
|
||||||
Place {
|
Place {
|
||||||
local: self_arg(),
|
local: self_arg(),
|
||||||
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Deref]),
|
projection: self.tcx().intern_place_elems(&[ProjectionElem::Deref]),
|
||||||
},
|
},
|
||||||
self.tcx,
|
self.tcx,
|
||||||
);
|
);
|
||||||
@ -153,7 +153,7 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> {
|
|||||||
place,
|
place,
|
||||||
Place {
|
Place {
|
||||||
local: self_arg(),
|
local: self_arg(),
|
||||||
projection: self.tcx().intern_place_elems(&vec![ProjectionElem::Field(
|
projection: self.tcx().intern_place_elems(&[ProjectionElem::Field(
|
||||||
Field::new(0),
|
Field::new(0),
|
||||||
self.ref_gen_ty,
|
self.ref_gen_ty,
|
||||||
)]),
|
)]),
|
||||||
|
@ -51,7 +51,7 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> {
|
|||||||
let new_place = match rvalue {
|
let new_place = match rvalue {
|
||||||
Rvalue::Ref(_, _, place) => {
|
Rvalue::Ref(_, _, place) => {
|
||||||
if let &[ref proj_l @ .., proj_r] = place.projection.as_ref() {
|
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 {
|
Place {
|
||||||
// Replace with dummy
|
// Replace with dummy
|
||||||
|
Loading…
Reference in New Issue
Block a user