about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-01-26 14:17:22 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-01-27 01:18:18 +0100
commitf7dcdcc0b96d4906288dadc459692ef80fd872a9 (patch)
tree8019d6d2bf6ed7056d0776ad664f35a178079d46
parentec61761e465a61869d13e89274afa02257aba6d7 (diff)
downloadrust-f7dcdcc0b96d4906288dadc459692ef80fd872a9.tar.gz
rust-f7dcdcc0b96d4906288dadc459692ef80fd872a9.zip
make matches exhaustive
-rw-r--r--src/librustc/mir/mod.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 27502b5f3e6..c9a89aae86f 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<F: TypeFolder<'tcx>>(&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 },
         }
     }