about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-06-16 00:32:45 -0400
committerGitHub <noreply@github.com>2017-06-16 00:32:45 -0400
commit999f3ad60dd47a9726f157f789511c2ada55402e (patch)
treec997d7ba33b803914be46821fcf78aa90fcd00d8
parentf05afa09a8906adab3a27621437465cb26a36ceb (diff)
parent65288f4026b7cb0c269bdc43bbacfdc37ddae92f (diff)
downloadrust-999f3ad60dd47a9726f157f789511c2ada55402e.tar.gz
rust-999f3ad60dd47a9726f157f789511c2ada55402e.zip
Rollup merge of #42656 - VBChunguk:struct-field-attributes, r=nikomatsakis
Remove struct_field_attributes feature gate

Part of #41681. ~This PR only removes the feature gate; this *does not* update any documentations.~ This PR removes the feature gate and the corresponding chapter of the Unstable Book.

I'm not very sure about the changes I made though... Just followed the stabilization guideline.

r? @nikomatsakis
-rw-r--r--src/doc/unstable-book/src/SUMMARY.md1
-rw-r--r--src/doc/unstable-book/src/language-features/struct-field-attributes.md10
-rw-r--r--src/librustc_data_structures/lib.rs2
-rw-r--r--src/libsyntax/config.rs28
-rw-r--r--src/libsyntax/feature_gate.rs5
-rw-r--r--src/test/compile-fail/struct-field-attr-feature-gate.rs22
-rw-r--r--src/test/compile-fail/struct-field-cfg.rs2
7 files changed, 3 insertions, 67 deletions
diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md
index 64bbb104f68..d8f742735a8 100644
--- a/src/doc/unstable-book/src/SUMMARY.md
+++ b/src/doc/unstable-book/src/SUMMARY.md
@@ -87,7 +87,6 @@
     - [start](language-features/start.md)
     - [static_nobundle](language-features/static-nobundle.md)
     - [stmt_expr_attributes](language-features/stmt-expr-attributes.md)
-    - [struct_field_attributes](language-features/struct-field-attributes.md)
     - [structural_match](language-features/structural-match.md)
     - [target_feature](language-features/target-feature.md)
     - [thread_local](language-features/thread-local.md)
diff --git a/src/doc/unstable-book/src/language-features/struct-field-attributes.md b/src/doc/unstable-book/src/language-features/struct-field-attributes.md
deleted file mode 100644
index 1a94562968d..00000000000
--- a/src/doc/unstable-book/src/language-features/struct-field-attributes.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# `struct_field_attributes`
-
-The tracking issue for this feature is: [#38814]
-
-[#38814]: https://github.com/rust-lang/rust/issues/38814
-
-------------------------
-
-
-
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index 83cd5cef00c..cc0e5dec266 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -36,11 +36,11 @@
 #![feature(discriminant_value)]
 #![feature(specialization)]
 #![feature(manually_drop)]
-#![feature(struct_field_attributes)]
 
 #![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))]
 #![cfg_attr(stage0, feature(rustc_private))]
 #![cfg_attr(stage0, feature(staged_api))]
+#![cfg_attr(stage0, feature(struct_field_attributes))]
 
 #![cfg_attr(unix, feature(libc))]
 #![cfg_attr(test, feature(test))]
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 2e98c7d9626..54e6dde41e6 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -223,7 +223,6 @@ impl<'a> StripUnconfigured<'a> {
             ast::ExprKind::Struct(path, fields, base) => {
                 let fields = fields.into_iter()
                     .filter_map(|field| {
-                        self.visit_struct_field_attrs(field.attrs());
                         self.configure(field)
                     })
                     .collect();
@@ -256,17 +255,6 @@ impl<'a> StripUnconfigured<'a> {
     }
 
     pub fn configure_struct_expr_field(&mut self, field: ast::Field) -> Option<ast::Field> {
-        if !self.features.map(|features| features.struct_field_attributes).unwrap_or(true) {
-            if !field.attrs.is_empty() {
-                let mut err = feature_err(self.sess,
-                                          "struct_field_attributes",
-                                          field.span,
-                                          GateIssue::Language,
-                                          "attributes on struct literal fields are unstable");
-                err.emit();
-            }
-        }
-
         self.configure(field)
     }
 
@@ -275,7 +263,6 @@ impl<'a> StripUnconfigured<'a> {
             if let ast::PatKind::Struct(path, fields, etc) = pattern.node {
                 let fields = fields.into_iter()
                     .filter_map(|field| {
-                        self.visit_struct_field_attrs(field.attrs());
                         self.configure(field)
                     })
                     .collect();
@@ -284,21 +271,6 @@ impl<'a> StripUnconfigured<'a> {
             pattern
         })
     }
-
-    fn visit_struct_field_attrs(&mut self, attrs: &[ast::Attribute]) {
-        // flag the offending attributes
-        for attr in attrs.iter() {
-            if !self.features.map(|features| features.struct_field_attributes).unwrap_or(true) {
-                let mut err = feature_err(
-                    self.sess,
-                    "struct_field_attributes",
-                    attr.span,
-                    GateIssue::Language,
-                    "attributes on struct pattern or literal fields are unstable");
-                err.emit();
-            }
-        }
-    }
 }
 
 impl<'a> fold::Folder for StripUnconfigured<'a> {
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 7ab0529f518..4543378789d 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -312,9 +312,6 @@ declare_features! (
     // Declarative macros 2.0 (`macro`).
     (active, decl_macro, "1.17.0", Some(39412)),
 
-    // Allows attributes on struct literal fields.
-    (active, struct_field_attributes, "1.16.0", Some(38814)),
-
     // Allows #[link(kind="static-nobundle"...]
     (active, static_nobundle, "1.16.0", Some(37403)),
 
@@ -430,6 +427,8 @@ declare_features! (
     (accepted, relaxed_adts, "1.19.0", Some(35626)),
     // Coerces non capturing closures to function pointers
     (accepted, closure_to_fn_coercion, "1.19.0", Some(39817)),
+    // Allows attributes on struct literal fields.
+    (accepted, struct_field_attributes, "1.20.0", Some(38814)),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must
diff --git a/src/test/compile-fail/struct-field-attr-feature-gate.rs b/src/test/compile-fail/struct-field-attr-feature-gate.rs
deleted file mode 100644
index 47495be4ad2..00000000000
--- a/src/test/compile-fail/struct-field-attr-feature-gate.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 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-struct_field_attributes
-
-struct Foo {
-    present: (),
-}
-
-fn main() {
-    let foo = Foo { #[cfg(all())] present: () };
-    //~^ ERROR attributes on struct pattern or literal fields are unstable
-    let Foo { #[cfg(all())] present: () } = foo;
-    //~^ ERROR attributes on struct pattern or literal fields are unstable
-}
diff --git a/src/test/compile-fail/struct-field-cfg.rs b/src/test/compile-fail/struct-field-cfg.rs
index 9fb130f4d54..974d500d9cb 100644
--- a/src/test/compile-fail/struct-field-cfg.rs
+++ b/src/test/compile-fail/struct-field-cfg.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(struct_field_attributes)]
-
 struct Foo {
     present: (),
 }