From f7dcdcc0b96d4906288dadc459692ef80fd872a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 26 Jan 2020 14:17:22 +0100 Subject: [PATCH] make matches exhaustive --- src/librustc/mir/mod.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 27502b5f3e61..c9a89aae86fd 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection { let projs: Vec<_> = self .projs .iter() - .map(|elem| match elem { + .map(|&elem| match elem { Deref => Deref, - Field(f, ()) => Field(*f, ()), + Field(f, ()) => Field(f, ()), Index(()) => Index(()), - elem => *elem, + Downcast(symbol, variantidx) => Downcast(symbol, variantidx), + ConstantIndex { offset, min_length, from_end } => { + ConstantIndex { offset, min_length, from_end } + } + Subslice { from, to, from_end } => Subslice { from, to, from_end }, }) .collect(); @@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> { fn super_fold_with>(&self, folder: &mut F) -> Self { use crate::mir::ProjectionElem::*; - match self { + match *self { Deref => Deref, - Field(f, ty) => Field(*f, ty.fold_with(folder)), + Field(f, ty) => Field(f, ty.fold_with(folder)), Index(v) => Index(v.fold_with(folder)), - elem => *elem, + Downcast(symbol, variantidx) => Downcast(symbol, variantidx), + ConstantIndex { offset, min_length, from_end } => { + ConstantIndex { offset, min_length, from_end } + } + Subslice { from, to, from_end } => Subslice { from, to, from_end }, } }