@@ -364,7 +364,12 @@ impl<'a> AstValidator<'a> {
364
364
self . err_handler ( ) . emit_err ( errors:: BoundInContext { span, ctx } ) ;
365
365
}
366
366
367
- fn check_foreign_ty_genericless ( & self , generics : & Generics , where_span : Span ) {
367
+ fn check_foreign_ty_genericless (
368
+ & self ,
369
+ generics : & Generics ,
370
+ before_where_clause : & TyAliasWhereClause ,
371
+ after_where_clause : & TyAliasWhereClause ,
372
+ ) {
368
373
let cannot_have = |span, descr, remove_descr| {
369
374
self . err_handler ( ) . emit_err ( errors:: ExternTypesCannotHave {
370
375
span,
@@ -378,9 +383,14 @@ impl<'a> AstValidator<'a> {
378
383
cannot_have ( generics. span , "generic parameters" , "generic parameters" ) ;
379
384
}
380
385
381
- if !generics. where_clause . predicates . is_empty ( ) {
382
- cannot_have ( where_span, "`where` clauses" , "`where` clause" ) ;
383
- }
386
+ let check_where_clause = |where_clause : & TyAliasWhereClause | {
387
+ if let TyAliasWhereClause ( true , where_clause_span) = where_clause {
388
+ cannot_have ( * where_clause_span, "`where` clauses" , "`where` clause" ) ;
389
+ }
390
+ } ;
391
+
392
+ check_where_clause ( before_where_clause) ;
393
+ check_where_clause ( after_where_clause) ;
384
394
}
385
395
386
396
fn check_foreign_kind_bodyless ( & self , ident : Ident , kind : & str , body : Option < Span > ) {
@@ -1039,7 +1049,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1039
1049
self . check_defaultness ( fi. span , * defaultness) ;
1040
1050
self . check_foreign_kind_bodyless ( fi. ident , "type" , ty. as_ref ( ) . map ( |b| b. span ) ) ;
1041
1051
self . check_type_no_bounds ( bounds, "`extern` blocks" ) ;
1042
- self . check_foreign_ty_genericless ( generics, where_clauses. 0 . 1 ) ;
1052
+ self . check_foreign_ty_genericless ( generics, & where_clauses. 0 , & where_clauses . 1 ) ;
1043
1053
self . check_foreign_item_ascii_only ( fi. ident ) ;
1044
1054
}
1045
1055
ForeignItemKind :: Static ( _, _, body) => {
0 commit comments