about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-25 13:12:43 +0200
committerGitHub <noreply@github.com>2019-10-25 13:12:43 +0200
commit959b6e324ce2786a4adade6cef222ffbd20f3791 (patch)
tree1198254311edbbef1b757b0dbe9f7641dba75dd2 /src/libsyntax
parent85943fd7c88ddf870b03afdd6cd6782721c348e1 (diff)
parente0590ea76f528357add6fd6615a82cf49e44f271 (diff)
downloadrust-959b6e324ce2786a4adade6cef222ffbd20f3791.tar.gz
rust-959b6e324ce2786a4adade6cef222ffbd20f3791.zip
Rollup merge of #64639 - davidtwco:rfc-2008-stabilization, r=Centril
Stabilize `#[non_exhaustive]` (RFC 2008)

Fixes #44109.

This pull request stabilizes the `#[non_exhaustive]` attribute, which is used to indicate that a type will have more fields / variants added in the future. It can be applied to `struct`s, `enum`s and `enum` variants. See https://github.com/rust-lang/rust/issues/44109#issuecomment-533356866 for the stabilization report.

r? @Centril
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate/accepted.rs4
-rw-r--r--src/libsyntax/feature_gate/active.rs3
-rw-r--r--src/libsyntax/feature_gate/builtin_attrs.rs4
3 files changed, 4 insertions, 7 deletions
diff --git a/src/libsyntax/feature_gate/accepted.rs b/src/libsyntax/feature_gate/accepted.rs
index cda1ef1436c..36fcab8450b 100644
--- a/src/libsyntax/feature_gate/accepted.rs
+++ b/src/libsyntax/feature_gate/accepted.rs
@@ -245,8 +245,10 @@ declare_features! (
     (accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
     /// Allows attributes in formal function parameters.
     (accepted, param_attrs, "1.39.0", Some(60406), None),
-    // Allows macro invocations in `extern {}` blocks.
+    /// Allows macro invocations in `extern {}` blocks.
     (accepted, macros_in_extern, "1.40.0", Some(49476), None),
+    /// Allows future-proofing enums/structs with the `#[non_exhaustive]` attribute (RFC 2008).
+    (accepted, non_exhaustive, "1.40.0", Some(44109), None),
 
     // -------------------------------------------------------------------------
     // feature-group-end: accepted features
diff --git a/src/libsyntax/feature_gate/active.rs b/src/libsyntax/feature_gate/active.rs
index 4f92401d2bc..f6e1d6c4224 100644
--- a/src/libsyntax/feature_gate/active.rs
+++ b/src/libsyntax/feature_gate/active.rs
@@ -383,9 +383,6 @@ declare_features! (
     /// Allows `#[doc(include = "some-file")]`.
     (active, external_doc, "1.22.0", Some(44732), None),
 
-    /// Allows future-proofing enums/structs with the `#[non_exhaustive]` attribute (RFC 2008).
-    (active, non_exhaustive, "1.22.0", Some(44109), None),
-
     /// Allows using `crate` as visibility modifier, synonymous with `pub(crate)`.
     (active, crate_visibility_modifier, "1.23.0", Some(53120), None),
 
diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs
index 7dd6ae90d9a..efe84238795 100644
--- a/src/libsyntax/feature_gate/builtin_attrs.rs
+++ b/src/libsyntax/feature_gate/builtin_attrs.rs
@@ -252,6 +252,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ungated!(path, Normal, template!(NameValueStr: "file")),
     ungated!(no_std, CrateLevel, template!(Word)),
     ungated!(no_implicit_prelude, Normal, template!(Word)),
+    ungated!(non_exhaustive, Whitelisted, template!(Word)),
 
     // Runtime
     ungated!(windows_subsystem, Whitelisted, template!(NameValueStr: "windows|console")),
@@ -314,9 +315,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         test_runner, CrateLevel, template!(List: "path"), custom_test_frameworks,
         "custom test frameworks are an unstable feature",
     ),
-
-    // RFC #2008
-    gated!(non_exhaustive, Whitelisted, template!(Word), experimental!(non_exhaustive)),
     // RFC #1268
     gated!(marker, Normal, template!(Word), marker_trait_attr, experimental!(marker)),
     gated!(