@@ -814,26 +814,25 @@ impl<'a> MethodDef<'a> {
814814 "no self match on an enum in \
815815 generic `deriving`") ;
816816 }
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+
817824 // we currently have a vec of vecs, where each
818825 // subvec is the fields of one of the arguments,
819826 // but if the variants all match, we want this as
820827 // vec of tuples, where each tuple represents a
821828 // field.
822829
823- let substructure;
824-
825830 // most arms don't have matching variants, so do a
826831 // quick check to see if they match (even though
827832 // this means iterating twice) instead of being
828833 // optimistic and doing a pile of allocations etc.
829- match matching {
834+ let substructure = match matching {
830835 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-
837836 let mut enum_matching_fields = Vec :: from_elem ( self_vec. len ( ) , Vec :: new ( ) ) ;
838837
839838 for triple in matches_so_far. tail ( ) . iter ( ) {
@@ -856,12 +855,12 @@ impl<'a> MethodDef<'a> {
856855 other : ( * other) . clone ( )
857856 }
858857 } ) . collect ( ) ;
859- substructure = EnumMatching ( variant_index, variant, field_tuples) ;
858+ EnumMatching ( variant_index, variant, field_tuples)
860859 }
861860 None => {
862- substructure = EnumNonMatching ( matches_so_far. as_slice ( ) ) ;
861+ EnumNonMatching ( matches_so_far. as_slice ( ) )
863862 }
864- }
863+ } ;
865864 self . call_substructure_method ( cx, trait_, type_ident,
866865 self_args, nonself_args,
867866 & substructure)
0 commit comments