Skip to content

Commit b490032

Browse files
committed
Avoid cloning Place in assign #1
1 parent 2a7d600 commit b490032

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/librustc_mir/transform/qualify_consts.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -865,14 +865,9 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
865865
(base, Some(proj)) => {
866866
// Catch more errors in the destination. `visit_place` also checks various
867867
// projection rules like union field access and raw pointer deref
868-
self.visit_place(
869-
&Place {
870-
base: base.clone(),
871-
projection: dest_projection.clone(),
872-
},
873-
PlaceContext::MutatingUse(MutatingUseContext::Store),
874-
location
875-
);
868+
let context = PlaceContext::MutatingUse(MutatingUseContext::Store);
869+
self.visit_place_base(base, context, location);
870+
self.visit_projection(base, proj, context, location);
876871
dest_projection = &proj.base;
877872
},
878873
(&PlaceBase::Static(box Static {

0 commit comments

Comments
 (0)