@@ -298,9 +298,8 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
298
298
/// `etc` is true if the pattern said '...' and false otherwise.
299
299
pub fn check_struct_pat_fields ( pcx : & pat_ctxt ,
300
300
span : Span ,
301
- path : & ast:: Path ,
302
301
fields : & [ ast:: FieldPat ] ,
303
- class_fields : Vec < ty:: field_ty > ,
302
+ class_fields : Vec < ty:: field_ty > ,
304
303
class_id : ast:: DefId ,
305
304
substitutions : & ty:: substs ,
306
305
etc : bool ) {
@@ -333,13 +332,12 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
333
332
found_fields. insert ( index) ;
334
333
}
335
334
None => {
336
- let name = pprust:: path_to_str ( path) ;
337
335
// Check the pattern anyway, so that attempts to look
338
336
// up its type won't fail
339
337
check_pat ( pcx, field. pat , ty:: mk_err ( ) ) ;
340
338
tcx. sess . span_err ( span,
341
339
format ! ( "struct `{}` does not have a field named `{}`" ,
342
- name ,
340
+ ty :: item_path_str ( tcx , class_id ) ,
343
341
token:: get_ident( field. ident) ) . as_slice ( ) ) ;
344
342
}
345
343
}
@@ -390,7 +388,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: Span,
390
388
}
391
389
}
392
390
393
- check_struct_pat_fields ( pcx, span, path , fields, class_fields, struct_id,
391
+ check_struct_pat_fields ( pcx, span, fields, class_fields, struct_id,
394
392
substitutions, etc) ;
395
393
}
396
394
@@ -413,7 +411,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
413
411
// Get the struct fields from this struct-like enum variant.
414
412
let class_fields = ty:: lookup_struct_fields ( tcx, variant_id) ;
415
413
416
- check_struct_pat_fields ( pcx, span, path , fields, class_fields,
414
+ check_struct_pat_fields ( pcx, span, fields, class_fields,
417
415
variant_id, substitutions, etc) ;
418
416
}
419
417
Some ( & ast:: DefStruct ( ..) ) | Some ( & ast:: DefVariant ( ..) ) => {
0 commit comments