Feature gate where clauses on associated types

This commit is contained in:
Matthew Jasper 2018-03-25 22:40:13 +01:00
parent 482a913fb3
commit d9cd6c6e8e
3 changed files with 32 additions and 5 deletions

View file

@ -1734,8 +1734,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
}
ast::TraitItemKind::Type(_, ref default) => {
// We use two if statements instead of something like match guards so that both
// of these errors can be emitted if both cases apply.
// We use three if statements instead of something like match guards so that all
// of these errors can be emitted if all cases apply.
if default.is_some() {
gate_feature_post!(&self, associated_type_defaults, ti.span,
"associated type defaults are unstable");
@ -1744,6 +1744,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
gate_feature_post!(&self, generic_associated_types, ti.span,
"generic associated types are unstable");
}
if !ti.generics.where_clause.predicates.is_empty() {
gate_feature_post!(&self, generic_associated_types, ti.span,
"where clauses on associated types are unstable");
}
}
_ => {}
}