@@ -1617,13 +1617,17 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1617
1617
gate_feature_post ! ( & self , const_fn, ti. span, "const fn is unstable" ) ;
1618
1618
}
1619
1619
}
1620
- ast:: TraitItemKind :: Type ( _, Some ( _) ) => {
1621
- gate_feature_post ! ( & self , associated_type_defaults, ti. span,
1622
- "associated type defaults are unstable" ) ;
1623
- }
1624
- _ if ti. generics . is_parameterized ( ) => {
1625
- gate_feature_post ! ( & self , generic_associated_types, ti. span,
1626
- "generic associated types are unstable" ) ;
1620
+ ast:: TraitItemKind :: Type ( _, default) => {
1621
+ // We use two if statements instead of something like match guards so that both
1622
+ // of these errors can be emitted if both cases apply.
1623
+ if default. is_some ( ) {
1624
+ gate_feature_post ! ( & self , associated_type_defaults, ti. span,
1625
+ "associated type defaults are unstable" ) ;
1626
+ }
1627
+ if ti. generics . is_parameterized ( ) {
1628
+ gate_feature_post ! ( & self , generic_associated_types, ti. span,
1629
+ "generic associated types are unstable" ) ;
1630
+ }
1627
1631
}
1628
1632
_ => { }
1629
1633
}
@@ -1643,7 +1647,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1643
1647
gate_feature_post ! ( & self , const_fn, ii. span, "const fn is unstable" ) ;
1644
1648
}
1645
1649
}
1646
- _ if ii. generics . is_parameterized ( ) => {
1650
+ ast :: ImplItemKind :: Type ( _ ) if ii. generics . is_parameterized ( ) => {
1647
1651
gate_feature_post ! ( & self , generic_associated_types, ii. span,
1648
1652
"generic associated types are unstable" ) ;
1649
1653
}
0 commit comments