@@ -1114,7 +1114,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11141114                tcx. sess . struct_span_err ( pat. span ,  "`..` cannot be used in union patterns" ) . emit ( ) ; 
11151115            } 
11161116        }  else  if  !etc && !unmentioned_fields. is_empty ( )  { 
1117-             unmentioned_err = Some ( self . error_unmentioned_fields ( pat. span ,  & unmentioned_fields) ) ; 
1117+             unmentioned_err = Some ( self . error_unmentioned_fields ( pat,  & unmentioned_fields) ) ; 
11181118        } 
11191119        match  ( inexistent_fields_err,  unmentioned_err)  { 
11201120            ( Some ( mut  i) ,  Some ( mut  u) )  => { 
@@ -1237,13 +1237,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12371237        if  tcx. sess . teach ( & err. get_code ( ) . unwrap ( ) )  { 
12381238            err. note ( 
12391239                "This error indicates that a struct pattern attempted to \  
1240-                       extract a non-existent field from a struct. Struct fields \ 
1241-                       are identified by the name used before the colon : so struct \ 
1242-                       patterns should resemble the declaration of the struct type \ 
1243-                       being matched.\n \n \ 
1244-                       If you are using shorthand field patterns but want to refer \ 
1245-                       to the struct field by a different name, you should rename \ 
1246-                       it explicitly.", 
1240+                   extract a non-existent field from a struct. Struct fields \ 
1241+                   are identified by the name used before the colon : so struct \ 
1242+                   patterns should resemble the declaration of the struct type \ 
1243+                   being matched.\n \n \ 
1244+                   If you are using shorthand field patterns but want to refer \ 
1245+                   to the struct field by a different name, you should rename \ 
1246+                   it explicitly.", 
12471247            ) ; 
12481248        } 
12491249        err
@@ -1299,7 +1299,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12991299
13001300    fn  error_unmentioned_fields ( 
13011301        & self , 
1302-         span :   Span , 
1302+         pat :   & Pat < ' _ > , 
13031303        unmentioned_fields :  & [ Ident ] , 
13041304    )  -> DiagnosticBuilder < ' tcx >  { 
13051305        let  field_names = if  unmentioned_fields. len ( )  == 1  { 
@@ -1312,23 +1312,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13121312                . join ( ", " ) ; 
13131313            format ! ( "fields {}" ,  fields) 
13141314        } ; 
1315-         let  mut  diag  = struct_span_err ! ( 
1315+         let  mut  err  = struct_span_err ! ( 
13161316            self . tcx. sess, 
1317-             span, 
1317+             pat . span, 
13181318            E0027 , 
13191319            "pattern does not mention {}" , 
13201320            field_names
13211321        ) ; 
1322-         diag . span_label ( span,  format ! ( "missing {}" ,  field_names) ) ; 
1323-         if  self . tcx . sess . teach ( & diag . get_code ( ) . unwrap ( ) )  { 
1324-             diag . note ( 
1322+         err . span_label ( pat . span ,  format ! ( "missing {}" ,  field_names) ) ; 
1323+         if  self . tcx . sess . teach ( & err . get_code ( ) . unwrap ( ) )  { 
1324+             err . note ( 
13251325                "This error indicates that a pattern for a struct fails to specify a \  
1326-                       sub-pattern for every one of the struct's fields. Ensure that each field \ 
1327-                       from the struct's definition is mentioned in the pattern, or use `..` to \ 
1328-                       ignore unwanted fields.", 
1326+                   sub-pattern for every one of the struct's fields. Ensure that each field \ 
1327+                   from the struct's definition is mentioned in the pattern, or use `..` to \ 
1328+                   ignore unwanted fields.", 
13291329            ) ; 
13301330        } 
1331-         diag 
1331+         err 
13321332    } 
13331333
13341334    fn  check_pat_box ( 
0 commit comments