about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDouglas Campos <qmx@qmx.me>2017-09-29 22:21:35 -0400
committerDouglas Campos <qmx@qmx.me>2017-09-29 22:34:51 -0400
commita29c770c68591f4defe355c6db0a8478b9ef053f (patch)
treefab0017945f48c71bbc53bfa51058b56bdd13f13
parent59e778e5e1932eaa97cd46bca8f58a8233c579d1 (diff)
downloadrust-a29c770c68591f4defe355c6db0a8478b9ef053f.tar.gz
rust-a29c770c68591f4defe355c6db0a8478b9ef053f.zip
make match exaustive
-rw-r--r--src/librustc/ty/instance.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs
index 9560d6359a5..35ab1cec4cf 100644
--- a/src/librustc/ty/instance.rs
+++ b/src/librustc/ty/instance.rs
@@ -247,15 +247,17 @@ fn resolve_associated_item<'a, 'tcx>(
                 substs: rcvr_substs
             })
         }
-        traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => {
-            Some(Instance {
-                def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
-                substs: rcvr_substs
-            })
-        }
-        _ => {
-            None
+        traits::VtableBuiltin(..) => {
+            if let Some(_) = tcx.lang_items().clone_trait() {
+                Some(Instance {
+                    def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
+                    substs: rcvr_substs
+                })
+            } else {
+                None
+            }
         }
+        traits::VtableDefaultImpl(..) | traits::VtableParam(..) => None
     }
 }
 
@@ -287,8 +289,9 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
                 //
                 // These are both the same at trans time.
                 Ok(true)
-            }
-        _ => Err(()),
+        }
+        (ty::ClosureKind::FnMut, _) |
+        (ty::ClosureKind::FnOnce, _) => Err(())
     }
 }