);
}
}
- ast::ForeignItemKind::Ty => {
+ ast::ForeignItemKind::TyAlias(..) => {
gate_feature_post!(&self, extern_types, i.span, "extern types are experimental");
}
- ast::ForeignItemKind::Macro(..) => {}
+ ast::ForeignItemKind::Macro(..) | ast::ForeignItemKind::Const(..) => {}
}
visit::walk_foreign_item(self, i)
visit::walk_ty(self, ty)
}
- fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) {
- if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty {
+ fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FnRetTy) {
+ if let ast::FnRetTy::Ty(ref output_ty) = *ret_ty {
if let ast::TyKind::Never = output_ty.kind {
// Do nothing.
} else {
if let Some(header) = fn_kind.header() {
// Stability of const fn methods are covered in `visit_assoc_item` below.
self.check_extern(header.ext);
+
+ if let (ast::Const::Yes(_), ast::Extern::Implicit)
+ | (ast::Const::Yes(_), ast::Extern::Explicit(_)) = (header.constness, header.ext)
+ {
+ gate_feature_post!(
+ &self,
+ const_extern_fn,
+ span,
+ "`const extern fn` definitions are unstable"
+ );
+ }
}
if fn_kind.ctxt() != Some(FnCtxt::Foreign) && fn_kind.decl().c_variadic() {
}
match i.kind {
- ast::AssocItemKind::Fn(ref sig, _) => {
- let constness = sig.header.constness.node;
- if let (ast::Constness::Const, AssocCtxt::Trait) = (constness, ctxt) {
+ ast::AssocItemKind::Fn(ref sig, _, _) => {
+ if let (ast::Const::Yes(_), AssocCtxt::Trait) = (sig.header.constness, ctxt) {
gate_feature_post!(&self, const_fn, i.span, "const fn is unstable");
}
}
- ast::AssocItemKind::TyAlias(_, ref ty) => {
+ ast::AssocItemKind::TyAlias(ref generics, _, ref ty) => {
if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
gate_feature_post!(
&self,
if let Some(ty) = ty {
self.check_impl_trait(ty);
}
- self.check_gat(&i.generics, i.span);
+ self.check_gat(generics, i.span);
}
_ => {}
}
gate_all!(async_closure, "async closures are unstable");
gate_all!(generators, "yield syntax is experimental");
gate_all!(or_patterns, "or-patterns syntax is experimental");
- gate_all!(const_extern_fn, "`const extern fn` definitions are unstable");
gate_all!(raw_ref_op, "raw address of syntax is experimental");
gate_all!(const_trait_bound_opt_out, "`?const` on trait bounds is experimental");
gate_all!(const_trait_impl, "const trait impls are experimental");