@@ -413,12 +413,16 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
413413 } ;
414414 if is_structure {
415415 let fields = ty:: lookup_struct_fields ( cx. tcx , vid) ;
416- let field_pats: Vec < FieldPat > = fields. into_iter ( )
416+ let field_pats: Vec < Spanned < FieldPat > > = fields. into_iter ( )
417417 . zip ( pats)
418418 . filter ( |& ( _, ref pat) | pat. node != PatWild ( PatWildSingle ) )
419- . map ( |( field, pat) | FieldPat {
420- ident : Ident :: new ( field. name ) ,
421- pat : pat
419+ . map ( |( field, pat) | Spanned {
420+ span : DUMMY_SP ,
421+ node : FieldPat {
422+ ident : Ident :: new ( field. name ) ,
423+ pat : pat,
424+ is_shorthand : true ,
425+ }
422426 } ) . collect ( ) ;
423427 let has_more_fields = field_pats. len ( ) < pats_len;
424428 PatStruct ( def_to_path ( cx. tcx , vid) , field_pats, has_more_fields)
@@ -427,7 +431,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
427431 }
428432 }
429433
430- ty:: ty_rptr( _, ty:: mt { ty : ty , .. } ) => {
434+ ty:: ty_rptr( _, ty:: mt { ty, .. } ) => {
431435 match ty:: get ( ty) . sty {
432436 ty:: ty_vec( _, Some ( n) ) => match ctor {
433437 & Single => {
@@ -495,7 +499,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: ty::t,
495499 ty:: ty_nil =>
496500 vec ! ( ConstantValue ( const_nil) ) ,
497501
498- ty:: ty_rptr( _, ty:: mt { ty : ty , .. } ) => match ty:: get ( ty) . sty {
502+ ty:: ty_rptr( _, ty:: mt { ty, .. } ) => match ty:: get ( ty) . sty {
499503 ty:: ty_vec( _, None ) =>
500504 range_inclusive ( 0 , max_slice_length) . map ( |length| Slice ( length) ) . collect ( ) ,
501505 _ => vec ! ( Single )
@@ -692,7 +696,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) ->
692696 match ty:: get ( ty) . sty {
693697 ty:: ty_tup( ref fs) => fs. len ( ) ,
694698 ty:: ty_uniq( _) => 1 u,
695- ty:: ty_rptr( _, ty:: mt { ty : ty , .. } ) => match ty:: get ( ty) . sty {
699+ ty:: ty_rptr( _, ty:: mt { ty, .. } ) => match ty:: get ( ty) . sty {
696700 ty:: ty_vec( _, None ) => match * ctor {
697701 Slice ( length) => length,
698702 ConstantValue ( _) => 0 u,
@@ -740,7 +744,7 @@ fn range_covered_by_constructor(ctor: &Constructor,
740744pub fn specialize < ' a > ( cx : & MatchCheckCtxt , r : & [ & ' a Pat ] ,
741745 constructor : & Constructor , col : uint , arity : uint ) -> Option < Vec < & ' a Pat > > {
742746 let & Pat {
743- id : pat_id, node : ref node, span : pat_span
747+ id : pat_id, ref node, span : pat_span
744748 } = raw_pat ( r[ col] ) ;
745749 let head: Option < Vec < & Pat > > = match node {
746750
@@ -806,8 +810,8 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
806810 class_id. map ( |variant_id| {
807811 let struct_fields = ty:: lookup_struct_fields ( cx. tcx , variant_id) ;
808812 let args = struct_fields. iter ( ) . map ( |sf| {
809- match pattern_fields. iter ( ) . find ( |f| f. ident . name == sf. name ) {
810- Some ( ref f) => & * f. pat ,
813+ match pattern_fields. iter ( ) . find ( |f| f. node . ident . name == sf. name ) {
814+ Some ( ref f) => & * f. node . pat ,
811815 _ => DUMMY_WILD_PAT
812816 }
813817 } ) . collect ( ) ;
0 commit comments