@@ -413,12 +413,16 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
413
413
} ;
414
414
if is_structure {
415
415
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 ( )
417
417
. zip ( pats)
418
418
. 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
+ }
422
426
} ) . collect ( ) ;
423
427
let has_more_fields = field_pats. len ( ) < pats_len;
424
428
PatStruct ( def_to_path ( cx. tcx , vid) , field_pats, has_more_fields)
@@ -427,7 +431,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
427
431
}
428
432
}
429
433
430
- ty:: ty_rptr( _, ty:: mt { ty : ty , .. } ) => {
434
+ ty:: ty_rptr( _, ty:: mt { ty, .. } ) => {
431
435
match ty:: get ( ty) . sty {
432
436
ty:: ty_vec( _, Some ( n) ) => match ctor {
433
437
& Single => {
@@ -495,7 +499,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: ty::t,
495
499
ty:: ty_nil =>
496
500
vec ! ( ConstantValue ( const_nil) ) ,
497
501
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 {
499
503
ty:: ty_vec( _, None ) =>
500
504
range_inclusive ( 0 , max_slice_length) . map ( |length| Slice ( length) ) . collect ( ) ,
501
505
_ => vec ! ( Single )
@@ -692,7 +696,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) ->
692
696
match ty:: get ( ty) . sty {
693
697
ty:: ty_tup( ref fs) => fs. len ( ) ,
694
698
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 {
696
700
ty:: ty_vec( _, None ) => match * ctor {
697
701
Slice ( length) => length,
698
702
ConstantValue ( _) => 0 u,
@@ -740,7 +744,7 @@ fn range_covered_by_constructor(ctor: &Constructor,
740
744
pub fn specialize < ' a > ( cx : & MatchCheckCtxt , r : & [ & ' a Pat ] ,
741
745
constructor : & Constructor , col : uint , arity : uint ) -> Option < Vec < & ' a Pat > > {
742
746
let & Pat {
743
- id : pat_id, node : ref node, span : pat_span
747
+ id : pat_id, ref node, span : pat_span
744
748
} = raw_pat ( r[ col] ) ;
745
749
let head: Option < Vec < & Pat > > = match node {
746
750
@@ -806,8 +810,8 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
806
810
class_id. map ( |variant_id| {
807
811
let struct_fields = ty:: lookup_struct_fields ( cx. tcx , variant_id) ;
808
812
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 ,
811
815
_ => DUMMY_WILD_PAT
812
816
}
813
817
} ) . collect ( ) ;
0 commit comments