about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-28 15:40:00 +0000
committerbors <bors@rust-lang.org>2019-04-28 15:40:00 +0000
commitbdfdbcd44d457b2ac6d0cea4fb71739d3166cb98 (patch)
tree955ea2d3b0e65214c781d6fda17b4e683d43da7a /src/libsyntax
parent012c300706a1d73b39f6de6f71ba8c1ae5f958e8 (diff)
parent3f30082625e0613f375c30b489e0069a9f7b177a (diff)
downloadrust-bdfdbcd44d457b2ac6d0cea4fb71739d3166cb98.tar.gz
rust-bdfdbcd44d457b2ac6d0cea4fb71739d3166cb98.zip
Auto merge of #60352 - Centril:const-incomplete-features, r=oli-obk
Float 'incomplete_features' out to a const for visibility

Float `let incomplete_features` out to a `const INCOMPLETE_FEATURES` and colocate near `active` features so that it is easier to find and edit.

r? @oli-obk

(use rollup)
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 98952ad918c..dcec646fa22 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -477,6 +477,14 @@ declare_features! (
     (active, c_variadic, "1.34.0", Some(44930), None),
 );
 
+// Some features are known to be incomplete and using them is likely to have
+// unanticipated results, such as compiler crashes. We warn the user about these
+// to alert them.
+const INCOMPLETE_FEATURES: &[&str] = &[
+    "generic_associated_types",
+    "const_generics"
+];
+
 declare_features! (
     (removed, import_shadowing, "1.0.0", None, None, None),
     (removed, managed_boxes, "1.0.0", None, None, None),
@@ -2150,11 +2158,6 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
         err.emit();
     }
 
-    // Some features are known to be incomplete and using them is likely to have
-    // unanticipated results, such as compiler crashes. We warn the user about these
-    // to alert them.
-    let incomplete_features = ["generic_associated_types", "const_generics"];
-
     let mut features = Features::new();
     let mut edition_enabled_features = FxHashMap::default();
 
@@ -2193,7 +2196,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
             }
 
             let name = mi.name_or_empty();
-            if incomplete_features.iter().any(|f| name == *f) {
+            if INCOMPLETE_FEATURES.iter().any(|f| name == *f) {
                 span_handler.struct_span_warn(
                     mi.span(),
                     &format!(