about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-24 05:51:28 -0700
committerbors <bors@rust-lang.org>2014-04-24 05:51:28 -0700
commitf5a5d7c32ca863533e53175da8afab6ba8d20f30 (patch)
tree6366d2d4c1aa8b848e54916908c1985fc45f7786 /src/libsyntax/ext
parente01e78fd00c78fd3b7f92fb0d6d58e05801d5d38 (diff)
parent6fa1f48237bc61cabcb63f75700ad7303f152c1f (diff)
downloadrust-f5a5d7c32ca863533e53175da8afab6ba8d20f30.tar.gz
rust-f5a5d7c32ca863533e53175da8afab6ba8d20f30.zip
auto merge of #13559 : FlaPer87/rust/remove-special-root, r=nikomatsakis
This patch removes the special auto-rooting for `@` from the borrow checker. With `@` moving into a library, it doesn't make sense to keep this code around anymore. It also simplifies `trans` by removing root checking from there 

@nikomatsakis

Closes: #11586
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/deriving/generic.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index 2b48cd58f50..bf886e51885 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -808,26 +808,25 @@ impl<'a> MethodDef<'a> {
                                 "no self match on an enum in \
                                 generic `deriving`");
             }
+
+            // `ref` inside let matches is buggy. Causes havoc wih rusc.
+            // let (variant_index, ref self_vec) = matches_so_far[0];
+            let (variant, self_vec) = match matches_so_far.get(0) {
+                &(_, v, ref s) => (v, s)
+            };
+
             // we currently have a vec of vecs, where each
             // subvec is the fields of one of the arguments,
             // but if the variants all match, we want this as
             // vec of tuples, where each tuple represents a
             // field.
 
-            let substructure;
-
             // most arms don't have matching variants, so do a
             // quick check to see if they match (even though
             // this means iterating twice) instead of being
             // optimistic and doing a pile of allocations etc.
-            match matching {
+            let substructure = match matching {
                 Some(variant_index) => {
-                    // `ref` inside let matches is buggy. Causes havoc wih rusc.
-                    // let (variant_index, ref self_vec) = matches_so_far[0];
-                    let (variant, self_vec) = match matches_so_far.get(0) {
-                        &(_, v, ref s) => (v, s)
-                    };
-
                     let mut enum_matching_fields = Vec::from_elem(self_vec.len(), Vec::new());
 
                     for triple in matches_so_far.tail().iter() {
@@ -850,12 +849,12 @@ impl<'a> MethodDef<'a> {
                             other: (*other).clone()
                         }
                     }).collect();
-                    substructure = EnumMatching(variant_index, variant, field_tuples);
+                    EnumMatching(variant_index, variant, field_tuples)
                 }
                 None => {
-                    substructure = EnumNonMatching(matches_so_far.as_slice());
+                    EnumNonMatching(matches_so_far.as_slice())
                 }
-            }
+            };
             self.call_substructure_method(cx, trait_, type_ident,
                                           self_args, nonself_args,
                                           &substructure)