@@ -139,14 +139,14 @@ impl<'a> AstValidator<'a> {
139
139
ty_alias : & TyAlias ,
140
140
) -> Result < ( ) , errors:: WhereClauseBeforeTypeAlias > {
141
141
let before_predicates =
142
- ty_alias. generics . where_clause . predicates . split_at ( ty_alias. where_predicates_split ) . 0 ;
142
+ ty_alias. generics . where_clause . predicates . split_at ( ty_alias. where_clauses . split ) . 0 ;
143
143
144
144
if ty_alias. ty . is_none ( ) || before_predicates. is_empty ( ) {
145
145
return Ok ( ( ) ) ;
146
146
}
147
147
148
148
let mut state = State :: new ( ) ;
149
- if !ty_alias. where_clauses . 1 . 0 {
149
+ if !ty_alias. where_clauses . after . has_where_token {
150
150
state. space ( ) ;
151
151
state. word_space ( "where" ) ;
152
152
} else {
@@ -161,13 +161,13 @@ impl<'a> AstValidator<'a> {
161
161
state. print_where_predicate ( p) ;
162
162
}
163
163
164
- let span = ty_alias. where_clauses . 0 . 1 ;
164
+ let span = ty_alias. where_clauses . before . span ;
165
165
Err ( errors:: WhereClauseBeforeTypeAlias {
166
166
span,
167
167
sugg : errors:: WhereClauseBeforeTypeAliasSugg {
168
168
left : span,
169
169
snippet : state. s . eof ( ) ,
170
- right : ty_alias. where_clauses . 1 . 1 . shrink_to_hi ( ) ,
170
+ right : ty_alias. where_clauses . after . span . shrink_to_hi ( ) ,
171
171
} ,
172
172
} )
173
173
}
@@ -457,8 +457,7 @@ impl<'a> AstValidator<'a> {
457
457
fn check_foreign_ty_genericless (
458
458
& self ,
459
459
generics : & Generics ,
460
- before_where_clause : & TyAliasWhereClause ,
461
- after_where_clause : & TyAliasWhereClause ,
460
+ where_clauses : & TyAliasWhereClauses ,
462
461
) {
463
462
let cannot_have = |span, descr, remove_descr| {
464
463
self . dcx ( ) . emit_err ( errors:: ExternTypesCannotHave {
@@ -473,14 +472,14 @@ impl<'a> AstValidator<'a> {
473
472
cannot_have ( generics. span , "generic parameters" , "generic parameters" ) ;
474
473
}
475
474
476
- let check_where_clause = |where_clause : & TyAliasWhereClause | {
477
- if let TyAliasWhereClause ( true , where_clause_span ) = where_clause {
478
- cannot_have ( * where_clause_span , "`where` clauses" , "`where` clause" ) ;
475
+ let check_where_clause = |where_clause : TyAliasWhereClause | {
476
+ if where_clause. has_where_token {
477
+ cannot_have ( where_clause . span , "`where` clauses" , "`where` clause" ) ;
479
478
}
480
479
} ;
481
480
482
- check_where_clause ( before_where_clause ) ;
483
- check_where_clause ( after_where_clause ) ;
481
+ check_where_clause ( where_clauses . before ) ;
482
+ check_where_clause ( where_clauses . after ) ;
484
483
}
485
484
486
485
fn check_foreign_kind_bodyless ( & self , ident : Ident , kind : & str , body : Option < Span > ) {
@@ -1121,9 +1120,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1121
1120
if let Err ( err) = self . check_type_alias_where_clause_location ( ty_alias) {
1122
1121
self . dcx ( ) . emit_err ( err) ;
1123
1122
}
1124
- } else if where_clauses. 1 . 0 {
1123
+ } else if where_clauses. after . has_where_token {
1125
1124
self . dcx ( ) . emit_err ( errors:: WhereClauseAfterTypeAlias {
1126
- span : where_clauses. 1 . 1 ,
1125
+ span : where_clauses. after . span ,
1127
1126
help : self . session . is_nightly_build ( ) . then_some ( ( ) ) ,
1128
1127
} ) ;
1129
1128
}
@@ -1153,7 +1152,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1153
1152
self . check_defaultness ( fi. span , * defaultness) ;
1154
1153
self . check_foreign_kind_bodyless ( fi. ident , "type" , ty. as_ref ( ) . map ( |b| b. span ) ) ;
1155
1154
self . check_type_no_bounds ( bounds, "`extern` blocks" ) ;
1156
- self . check_foreign_ty_genericless ( generics, & where_clauses. 0 , & where_clauses . 1 ) ;
1155
+ self . check_foreign_ty_genericless ( generics, where_clauses) ;
1157
1156
self . check_foreign_item_ascii_only ( fi. ident ) ;
1158
1157
}
1159
1158
ForeignItemKind :: Static ( _, _, body) => {
0 commit comments