@@ -287,6 +287,25 @@ impl<'a> PostExpansionVisitor<'a> {
287
287
err. emit ( ) ;
288
288
}
289
289
}
290
+
291
+ fn check_gat ( & self , generics : & ast:: Generics , span : Span ) {
292
+ if !generics. params . is_empty ( ) {
293
+ gate_feature_post ! (
294
+ & self ,
295
+ generic_associated_types,
296
+ span,
297
+ "generic associated types are unstable"
298
+ ) ;
299
+ }
300
+ if !generics. where_clause . predicates . is_empty ( ) {
301
+ gate_feature_post ! (
302
+ & self ,
303
+ generic_associated_types,
304
+ span,
305
+ "where clauses on associated types are unstable"
306
+ ) ;
307
+ }
308
+ }
290
309
}
291
310
292
311
impl < ' a > Visitor < ' a > for PostExpansionVisitor < ' a > {
@@ -566,14 +585,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
566
585
gate_feature_post ! ( & self , associated_type_defaults, ti. span,
567
586
"associated type defaults are unstable" ) ;
568
587
}
569
- if !ti. generics . params . is_empty ( ) {
570
- gate_feature_post ! ( & self , generic_associated_types, ti. span,
571
- "generic associated types are unstable" ) ;
572
- }
573
- if !ti. generics . where_clause . predicates . is_empty ( ) {
574
- gate_feature_post ! ( & self , generic_associated_types, ti. span,
575
- "where clauses on associated types are unstable" ) ;
576
- }
588
+ self . check_gat ( & ti. generics , ti. span ) ;
577
589
}
578
590
_ => { }
579
591
}
@@ -603,14 +615,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
603
615
) ;
604
616
}
605
617
ast:: ImplItemKind :: TyAlias ( _) => {
606
- if !ii. generics . params . is_empty ( ) {
607
- gate_feature_post ! ( & self , generic_associated_types, ii. span,
608
- "generic associated types are unstable" ) ;
609
- }
610
- if !ii. generics . where_clause . predicates . is_empty ( ) {
611
- gate_feature_post ! ( & self , generic_associated_types, ii. span,
612
- "where clauses on associated types are unstable" ) ;
613
- }
618
+ self . check_gat ( & ii. generics , ii. span ) ;
614
619
}
615
620
_ => { }
616
621
}
0 commit comments