Skip to content

Commit 2483c81

Browse files
committed
Deduplicate match arms
1 parent 61c58c2 commit 2483c81

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/librustc_mir/transform/qualify_consts.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,11 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
293293
debug!("store to var {:?}", index);
294294
self.local_qualif[index] = Some(self.qualif);
295295
}
296-
Place::Local(index) if self.mir.local_kind(index) == LocalKind::Temp => {
297-
debug!("store to temp {:?}", index);
296+
Place::Local(index) if self.mir.local_kind(index) == LocalKind::Temp ||
297+
self.mir.local_kind(index) == LocalKind::ReturnPointer => {
298+
debug!("store to {:?} (temp or return pointer)", index);
298299
store(&mut self.local_qualif[index])
299300
}
300-
Place::Local(index) if self.mir.local_kind(index) == LocalKind::ReturnPointer => {
301-
debug!("store to return place {:?}", index);
302-
store(&mut self.local_qualif[RETURN_PLACE])
303-
}
304301

305302
Place::Projection(box Projection {
306303
base: Place::Local(index),
@@ -772,7 +769,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
772769
}
773770
if let Place::Local(local) = *place {
774771
if self.mir.local_kind(local) == LocalKind::Temp {
775-
if let Some(qualif) = self.temp_qualif[local] {
772+
if let Some(qualif) = self.local_qualif[local] {
776773
// `forbidden_mut` is false, so we can safely ignore
777774
// `MUTABLE_INTERIOR` from the local's qualifications.
778775
// This allows borrowing fields which don't have

0 commit comments

Comments
 (0)