提交 c2aaba9b 编写于 作者: S Sunjay Varma

Specifically gating generic_associated_types feature on associated Type declarations

上级 e565b5bb
......@@ -1617,13 +1617,17 @@ fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable");
}
}
ast::TraitItemKind::Type(_, Some(_)) => {
gate_feature_post!(&self, associated_type_defaults, ti.span,
"associated type defaults are unstable");
}
_ if ti.generics.is_parameterized() => {
gate_feature_post!(&self, generic_associated_types, ti.span,
"generic associated types are unstable");
ast::TraitItemKind::Type(_, 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.
if default.is_some() {
gate_feature_post!(&self, associated_type_defaults, ti.span,
"associated type defaults are unstable");
}
if ti.generics.is_parameterized() {
gate_feature_post!(&self, generic_associated_types, ti.span,
"generic associated types are unstable");
}
}
_ => {}
}
......@@ -1643,7 +1647,7 @@ fn visit_impl_item(&mut self, ii: &'a ast::ImplItem) {
gate_feature_post!(&self, const_fn, ii.span, "const fn is unstable");
}
}
_ if ii.generics.is_parameterized() => {
ast::ImplItemKind::Type(_) if ii.generics.is_parameterized() => {
gate_feature_post!(&self, generic_associated_types, ii.span,
"generic associated types are unstable");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册