From a4891699125fa12d46217890e4eb68b35e9ff6d5 Mon Sep 17 00:00:00 2001 From: F001 Date: Tue, 28 Aug 2018 12:51:43 +0800 Subject: implement feature tuple_struct_self_ctor --- src/libsyntax/feature_gate.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index d98e4574399..4d24abcf90e 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -512,6 +512,9 @@ declare_features! ( // Non-builtin attributes in inner attribute position (active, custom_inner_attributes, "1.30.0", Some(38356), None), + + // tuple struct self constructor (RFC 2302) + (active, tuple_struct_self_ctor, "1.31.0", Some(51994), None), ); declare_features! ( @@ -1736,6 +1739,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::ExprKind::Async(..) => { gate_feature_post!(&self, async_await, e.span, "async blocks are unstable"); } + ast::ExprKind::Call(ref callee, _) => { + if let ast::ExprKind::Path(_, ref p) = callee.node { + if p.segments.len() == 1 && + p.segments[0].ident.name == keywords::SelfType.name() { + gate_feature_post!(&self, tuple_struct_self_ctor, e.span, + "tuple struct Self constructors are unstable"); + } + } + } _ => {} } visit::walk_expr(self, e); -- cgit 1.4.1-3-g733a5