about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMatthew <mjjasper1@gmail.com>2017-04-20 14:05:46 +0100
committerMatthew <mjjasper1@gmail.com>2017-04-20 14:05:46 +0100
commit5fc25224da78afcfdd76783c38ad3beff42a990c (patch)
tree31b1e2f4025ad234a4f903beb369822d5c78fc5f /src/libsyntax
parentfa6b50fc6282a2c64814b35b16464a22f4ae9265 (diff)
downloadrust-5fc25224da78afcfdd76783c38ad3beff42a990c.tar.gz
rust-5fc25224da78afcfdd76783c38ad3beff42a990c.zip
Stabilize RFC 1506 - clarified ADT kinds
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 175447e1112..81ab1a348d6 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -269,9 +269,6 @@ declare_features! (
     // Allows `impl Trait` in function return types.
     (active, conservative_impl_trait, "1.12.0", Some(34511)),
 
-    // Permits numeric fields in struct expressions and patterns.
-    (active, relaxed_adts, "1.12.0", Some(35626)),
-
     // The `!` type
     (active, never_type, "1.13.0", Some(35121)),
 
@@ -420,7 +417,10 @@ declare_features! (
     (accepted, pub_restricted, "1.18.0", Some(32409)),
     // The #![windows_subsystem] attribute
     (accepted, windows_subsystem, "1.18.0", Some(37499)),
+    // Permits numeric fields in struct expressions and patterns.
+    (accepted, relaxed_adts, "1.18.0", Some(35626)),
 );
+
 // If you change this, please modify src/doc/unstable-book as well. You must
 // move that documentation into the relevant place in the other docs, and
 // remove the chapter on the flag.
@@ -1102,10 +1102,6 @@ fn contains_novel_literal(item: &ast::MetaItem) -> bool {
     }
 }
 
-fn starts_with_digit(s: &str) -> bool {
-    s.as_bytes().first().cloned().map_or(false, |b| b >= b'0' && b <= b'9')
-}
-
 impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
     fn visit_attribute(&mut self, attr: &ast::Attribute) {
         if !attr.span.allows_unstable() {
@@ -1283,15 +1279,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
             ast::ExprKind::InPlace(..) => {
                 gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
             }
-            ast::ExprKind::Struct(_, ref fields, _) => {
-                for field in fields {
-                    if starts_with_digit(&field.ident.node.name.as_str()) {
-                        gate_feature_post!(&self, relaxed_adts,
-                                          field.span,
-                                          "numeric fields in struct expressions are unstable");
-                    }
-                }
-            }
             ast::ExprKind::Break(_, Some(_)) => {
                 gate_feature_post!(&self, loop_break_value, e.span,
                                    "`break` with a value is experimental");
@@ -1335,15 +1322,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                                   pattern.span,
                                   "box pattern syntax is experimental");
             }
-            PatKind::Struct(_, ref fields, _) => {
-                for field in fields {
-                    if starts_with_digit(&field.node.ident.name.as_str()) {
-                        gate_feature_post!(&self, relaxed_adts,
-                                          field.span,
-                                          "numeric fields in struct patterns are unstable");
-                    }
-                }
-            }
             PatKind::Range(_, _, RangeEnd::Excluded) => {
                 gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
                                    "exclusive range pattern syntax is experimental");