diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index d1f82af3416b..03193400f88e 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2416,10 +2416,10 @@ pub fn mk_place_index(self, place: Place<'tcx>, index: Local) -> Place<'tcx> { /// to build a full `Place` it's just a convenient way to grab a projection and modify it in /// flight. pub fn mk_place_elem(self, place: Place<'tcx>, elem: PlaceElem<'tcx>) -> Place<'tcx> { - let mut projection = place.projection.to_vec(); - projection.push(elem); - - Place { local: place.local, projection: self.mk_place_elems(&projection) } + Place { + local: place.local, + projection: self.mk_place_elems_from_iter(place.projection.iter().chain([elem])), + } } pub fn mk_poly_existential_predicates(