@@ -364,7 +364,12 @@ impl<'a> AstValidator<'a> {
364364 self . err_handler ( ) . emit_err ( errors:: BoundInContext { span, ctx } ) ;
365365 }
366366
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+ ) {
368373 let cannot_have = |span, descr, remove_descr| {
369374 self . err_handler ( ) . emit_err ( errors:: ExternTypesCannotHave {
370375 span,
@@ -378,9 +383,14 @@ impl<'a> AstValidator<'a> {
378383 cannot_have ( generics. span , "generic parameters" , "generic parameters" ) ;
379384 }
380385
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) ;
384394 }
385395
386396 fn check_foreign_kind_bodyless ( & self , ident : Ident , kind : & str , body : Option < Span > ) {
@@ -1039,7 +1049,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
10391049 self . check_defaultness ( fi. span , * defaultness) ;
10401050 self . check_foreign_kind_bodyless ( fi. ident , "type" , ty. as_ref ( ) . map ( |b| b. span ) ) ;
10411051 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 ) ;
10431053 self . check_foreign_item_ascii_only ( fi. ident ) ;
10441054 }
10451055 ForeignItemKind :: Static ( _, _, body) => {
0 commit comments