From 2483c812176c8ecca54207517a2ba5500805b205 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 22 May 2018 13:56:37 +0200 Subject: [PATCH] Deduplicate match arms --- src/librustc_mir/transform/qualify_consts.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index bb554b5e806..999e3d89fc7 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -293,14 +293,11 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { debug!("store to var {:?}", index); self.local_qualif[index] = Some(self.qualif); } - Place::Local(index) if self.mir.local_kind(index) == LocalKind::Temp => { - debug!("store to temp {:?}", index); + Place::Local(index) if self.mir.local_kind(index) == LocalKind::Temp || + self.mir.local_kind(index) == LocalKind::ReturnPointer => { + debug!("store to {:?} (temp or return pointer)", index); store(&mut self.local_qualif[index]) } - Place::Local(index) if self.mir.local_kind(index) == LocalKind::ReturnPointer => { - debug!("store to return place {:?}", index); - store(&mut self.local_qualif[RETURN_PLACE]) - } Place::Projection(box Projection { base: Place::Local(index), @@ -772,7 +769,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { } if let Place::Local(local) = *place { if self.mir.local_kind(local) == LocalKind::Temp { - if let Some(qualif) = self.temp_qualif[local] { + if let Some(qualif) = self.local_qualif[local] { // `forbidden_mut` is false, so we can safely ignore // `MUTABLE_INTERIOR` from the local's qualifications. // This allows borrowing fields which don't have