]> git.lizzy.rs Git - rust.git/commitdiff
make `Default` Copy and Clone
authorNiko Matsakis <niko@alum.mit.edu>
Sat, 15 Jul 2017 18:52:32 +0000 (14:52 -0400)
committerSean Griffin <sean@seantheprogrammer.com>
Thu, 1 Mar 2018 15:04:26 +0000 (08:04 -0700)
src/librustc/infer/type_variable.rs

index d89625ac871a75c009a49a408c1f3a95dbeb433c..36afb8b536725134f449f54f59a9b678265d23d3 100644 (file)
@@ -89,7 +89,7 @@ enum TypeVariableValue<'tcx> {
 
 // We will use this to store the required information to recapitulate what happened when
 // an error occurs.
-#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 pub struct Default<'tcx> {
     pub ty: Ty<'tcx>,
     /// The span where the default was incurred
@@ -123,7 +123,7 @@ pub fn new() -> TypeVariableTable<'tcx> {
     pub fn default(&self, vid: ty::TyVid) -> Option<Default<'tcx>> {
         match &self.values.get(vid.index as usize).value {
             &Known { .. } => None,
-            &Bounded { ref default, .. } => default.clone()
+            &Bounded { default, .. } => default,
         }
     }
 
@@ -185,7 +185,7 @@ pub fn new_var(&mut self,
         self.eq_relations.new_key(());
         self.sub_relations.new_key(());
         let index = self.values.push(TypeVariableData {
-            value: Bounded { default: default },
+            value: Bounded { default },
             origin,
             diverging,
         });