Avoid cloning Place in report_cannot_move_from_static

This commit is contained in:
Santiago Pastorino 2019-07-19 20:46:16 +02:00
parent 95e727a5c3
commit 09014fc793

View File

@ -283,15 +283,15 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
while let Some(box Projection { base: Some(ref proj), .. }) = base_static {
base_static = &proj.base;
}
let base_static = Place {
base: place.base.clone(),
projection: base_static.clone(),
let base_static = PlaceRef {
base: &place.base,
projection: base_static,
};
format!(
"`{:?}` as `{:?}` is a static item",
self.describe_place(place.as_place_ref()).unwrap(),
self.describe_place(base_static.as_place_ref()).unwrap(),
self.describe_place(base_static).unwrap(),
)
};