@@ -814,26 +814,25 @@ impl<'a> MethodDef<'a> {
814
814
"no self match on an enum in \
815
815
generic `deriving`") ;
816
816
}
817
+
818
+ // `ref` inside let matches is buggy. Causes havoc wih rusc.
819
+ // let (variant_index, ref self_vec) = matches_so_far[0];
820
+ let ( variant, self_vec) = match matches_so_far. get ( 0 ) {
821
+ & ( _, v, ref s) => ( v, s)
822
+ } ;
823
+
817
824
// we currently have a vec of vecs, where each
818
825
// subvec is the fields of one of the arguments,
819
826
// but if the variants all match, we want this as
820
827
// vec of tuples, where each tuple represents a
821
828
// field.
822
829
823
- let substructure;
824
-
825
830
// most arms don't have matching variants, so do a
826
831
// quick check to see if they match (even though
827
832
// this means iterating twice) instead of being
828
833
// optimistic and doing a pile of allocations etc.
829
- match matching {
834
+ let substructure = match matching {
830
835
Some ( variant_index) => {
831
- // `ref` inside let matches is buggy. Causes havoc wih rusc.
832
- // let (variant_index, ref self_vec) = matches_so_far[0];
833
- let ( variant, self_vec) = match matches_so_far. get ( 0 ) {
834
- & ( _, v, ref s) => ( v, s)
835
- } ;
836
-
837
836
let mut enum_matching_fields = Vec :: from_elem ( self_vec. len ( ) , Vec :: new ( ) ) ;
838
837
839
838
for triple in matches_so_far. tail ( ) . iter ( ) {
@@ -856,12 +855,12 @@ impl<'a> MethodDef<'a> {
856
855
other : ( * other) . clone ( )
857
856
}
858
857
} ) . collect ( ) ;
859
- substructure = EnumMatching ( variant_index, variant, field_tuples) ;
858
+ EnumMatching ( variant_index, variant, field_tuples)
860
859
}
861
860
None => {
862
- substructure = EnumNonMatching ( matches_so_far. as_slice ( ) ) ;
861
+ EnumNonMatching ( matches_so_far. as_slice ( ) )
863
862
}
864
- }
863
+ } ;
865
864
self . call_substructure_method ( cx, trait_, type_ident,
866
865
self_args, nonself_args,
867
866
& substructure)
0 commit comments