about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-25 07:24:18 +0000
committerbors <bors@rust-lang.org>2017-05-25 07:24:18 +0000
commitd0811c9148ff4fa15aba69e7fb11d7ec5dabbe8d (patch)
treebb1c51ef78c46bf617f646c6cd7b701525bca8ad /src
parentffb0e2dba38adb0bacf6636719bfe709286851fd (diff)
parent6627ef228c1396c045b3e9f24edaf66b76516cbd (diff)
downloadrust-d0811c9148ff4fa15aba69e7fb11d7ec5dabbe8d.tar.gz
rust-d0811c9148ff4fa15aba69e7fb11d7ec5dabbe8d.zip
Auto merge of #41145 - matthewjasper:stabilize-relaxed-adts, r=petrochenkov
Stabilize rfc 1506 - Clarified ADT Kinds

Closes #35626

Documentation:

- [ ] Reference rust-lang-nursery/reference#37
- [ ] Book?
- [ ] Rust by example?
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/SUMMARY.md1
-rw-r--r--src/doc/unstable-book/src/language-features/relaxed-adts.md10
-rw-r--r--src/libsyntax/feature_gate.rs28
-rw-r--r--src/test/compile-fail/numeric-fields-feature-gate.rs20
-rw-r--r--src/test/compile-fail/numeric-fields.rs2
-rw-r--r--src/test/run-pass/numeric-fields.rs2
6 files changed, 3 insertions, 60 deletions
diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md
index 456a683dc33..028f5c9ee5a 100644
--- a/src/doc/unstable-book/src/SUMMARY.md
+++ b/src/doc/unstable-book/src/SUMMARY.md
@@ -71,7 +71,6 @@
     - [prelude_import](language-features/prelude-import.md)
     - [proc_macro](language-features/proc-macro.md)
     - [quote](language-features/quote.md)
-    - [relaxed_adts](language-features/relaxed-adts.md)
     - [repr_align](language-features/repr-align.md)
     - [repr_simd](language-features/repr-simd.md)
     - [rustc_attrs](language-features/rustc-attrs.md)
diff --git a/src/doc/unstable-book/src/language-features/relaxed-adts.md b/src/doc/unstable-book/src/language-features/relaxed-adts.md
deleted file mode 100644
index 170570e06a2..00000000000
--- a/src/doc/unstable-book/src/language-features/relaxed-adts.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# `relaxed_adts`
-
-The tracking issue for this feature is: [#35626]
-
-[#35626]: https://github.com/rust-lang/rust/issues/35626
-
-------------------------
-
-
-
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index e1b7d4681ad..6acf27f314a 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)),
 
@@ -422,7 +419,10 @@ declare_features! (
     (accepted, windows_subsystem, "1.18.0", Some(37499)),
     // Allows `break {expr}` with a value inside `loop`s.
     (accepted, loop_break_value, "1.19.0", Some(37339)),
+    // Permits numeric fields in struct expressions and patterns.
+    (accepted, relaxed_adts, "1.19.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.
@@ -1104,10 +1104,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() {
@@ -1291,15 +1287,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::Lit(ref lit) => {
                 if let ast::LitKind::Int(_, ref ty) = lit.node {
                     match *ty {
@@ -1339,15 +1326,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");
diff --git a/src/test/compile-fail/numeric-fields-feature-gate.rs b/src/test/compile-fail/numeric-fields-feature-gate.rs
deleted file mode 100644
index bd8ec16ef88..00000000000
--- a/src/test/compile-fail/numeric-fields-feature-gate.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// gate-test-relaxed_adts
-
-struct S(u8);
-
-fn main() {
-    let s = S{0: 10}; //~ ERROR numeric fields in struct expressions are unstable
-    match s {
-        S{0: a, ..} => {} //~ ERROR numeric fields in struct patterns are unstable
-    }
-}
diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/compile-fail/numeric-fields.rs
index 0dc5c4bcfa2..00fde3025a6 100644
--- a/src/test/compile-fail/numeric-fields.rs
+++ b/src/test/compile-fail/numeric-fields.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(relaxed_adts)]
-
 struct S(u8, u16);
 
 fn main() {
diff --git a/src/test/run-pass/numeric-fields.rs b/src/test/run-pass/numeric-fields.rs
index 25e5a2a0fd5..15f054de79d 100644
--- a/src/test/run-pass/numeric-fields.rs
+++ b/src/test/run-pass/numeric-fields.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(relaxed_adts)]
-
 struct S(u8, u16);
 
 fn main() {