about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorF001 <changchun.fan@qq.com>2018-08-28 12:51:43 +0800
committerF001 <changchun.fan@qq.com>2018-09-13 10:57:28 +0800
commita4891699125fa12d46217890e4eb68b35e9ff6d5 (patch)
treebe5ca3676bccdcaeeb465f862d0e0195bb3f0c11 /src/libsyntax
parentf2302daef3608c09e2b50193a64611b18ced86f3 (diff)
downloadrust-a4891699125fa12d46217890e4eb68b35e9ff6d5.tar.gz
rust-a4891699125fa12d46217890e4eb68b35e9ff6d5.zip
implement feature tuple_struct_self_ctor
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs12
1 files changed, 12 insertions, 0 deletions
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);