diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 98952ad918c9..dcec646fa220 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -477,6 +477,14 @@ pub fn walk_feature_fields(&self, mut f: F) (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 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { 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 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { } 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!(