1
Fork 0

Feature gate

This commit is contained in:
Michael Goulet 2023-03-04 02:23:36 +00:00
parent f50c1e1f05
commit fb9ca9223d
6 changed files with 73 additions and 6 deletions

View file

@ -482,12 +482,21 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {
if let AssocConstraintKind::Bound { .. } = constraint.kind {
gate_feature_post!(
&self,
associated_type_bounds,
constraint.span,
"associated type bounds are unstable"
)
if constraint.gen_args.as_ref().map_or(false, |args| args.is_parenthesized()) {
gate_feature_post!(
&self,
return_type_notation,
constraint.span,
"return type notation is unstable"
)
} else {
gate_feature_post!(
&self,
associated_type_bounds,
constraint.span,
"associated type bounds are unstable"
)
}
}
visit::walk_assoc_constraint(self, constraint)
}