Skip to content

Commit bdfdbcd

Browse files
committed
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)
2 parents 012c300 + 3f30082 commit bdfdbcd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/libsyntax/feature_gate.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,14 @@ declare_features! (
477477
(active, c_variadic, "1.34.0", Some(44930), None),
478478
);
479479

480+
// Some features are known to be incomplete and using them is likely to have
481+
// unanticipated results, such as compiler crashes. We warn the user about these
482+
// to alert them.
483+
const INCOMPLETE_FEATURES: &[&str] = &[
484+
"generic_associated_types",
485+
"const_generics"
486+
];
487+
480488
declare_features! (
481489
(removed, import_shadowing, "1.0.0", None, None, None),
482490
(removed, managed_boxes, "1.0.0", None, None, None),
@@ -2150,11 +2158,6 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
21502158
err.emit();
21512159
}
21522160

2153-
// Some features are known to be incomplete and using them is likely to have
2154-
// unanticipated results, such as compiler crashes. We warn the user about these
2155-
// to alert them.
2156-
let incomplete_features = ["generic_associated_types", "const_generics"];
2157-
21582161
let mut features = Features::new();
21592162
let mut edition_enabled_features = FxHashMap::default();
21602163

@@ -2193,7 +2196,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
21932196
}
21942197

21952198
let name = mi.name_or_empty();
2196-
if incomplete_features.iter().any(|f| name == *f) {
2199+
if INCOMPLETE_FEATURES.iter().any(|f| name == *f) {
21972200
span_handler.struct_span_warn(
21982201
mi.span(),
21992202
&format!(

0 commit comments

Comments
 (0)