@@ -970,7 +970,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
970970 self . field_ty ( span, f, substs)
971971 } )
972972 . unwrap_or_else ( || {
973- inexistent_fields. push ( ( span , field. ident ) ) ;
973+ inexistent_fields. push ( field. ident ) ;
974974 no_field_errors = false ;
975975 tcx. types . err
976976 } )
@@ -986,24 +986,24 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
986986 . collect :: < Vec < _ > > ( ) ;
987987 if inexistent_fields. len ( ) > 0 && !variant. recovered {
988988 let ( field_names, t, plural) = if inexistent_fields. len ( ) == 1 {
989- ( format ! ( "a field named `{}`" , inexistent_fields[ 0 ] . 1 ) , "this" , "" )
989+ ( format ! ( "a field named `{}`" , inexistent_fields[ 0 ] ) , "this" , "" )
990990 } else {
991991 ( format ! ( "fields named {}" ,
992992 inexistent_fields. iter( )
993- . map( |( _ , name ) | format!( "`{}`" , name ) )
993+ . map( |ident | format!( "`{}`" , ident ) )
994994 . collect:: <Vec <String >>( )
995995 . join( ", " ) ) , "these" , "s" )
996996 } ;
997- let spans = inexistent_fields. iter ( ) . map ( |( span , _ ) | * span) . collect :: < Vec < _ > > ( ) ;
997+ let spans = inexistent_fields. iter ( ) . map ( |ident| ident . span ) . collect :: < Vec < _ > > ( ) ;
998998 let mut err = struct_span_err ! ( tcx. sess,
999999 spans,
10001000 E0026 ,
10011001 "{} `{}` does not have {}" ,
10021002 kind_name,
10031003 tcx. def_path_str( variant. def_id) ,
10041004 field_names) ;
1005- if let Some ( ( span , ident) ) = inexistent_fields. last ( ) {
1006- err. span_label ( * span,
1005+ if let Some ( ident) = inexistent_fields. last ( ) {
1006+ err. span_label ( ident . span ,
10071007 format ! ( "{} `{}` does not have {} field{}" ,
10081008 kind_name,
10091009 tcx. def_path_str( variant. def_id) ,
@@ -1015,8 +1015,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
10151015 find_best_match_for_name ( input, & ident. as_str ( ) , None ) ;
10161016 if let Some ( suggested_name) = suggested_name {
10171017 err. span_suggestion (
1018- * span,
1019- "did you mean " ,
1018+ ident . span ,
1019+ "a field with a similar name exists " ,
10201020 suggested_name. to_string ( ) ,
10211021 Applicability :: MaybeIncorrect ,
10221022 ) ;
0 commit comments