Skip to content

Commit 4463885

Browse files
committed
rename lang feature lists to include LANG
1 parent e82bca6 commit 4463885

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

Diff for: compiler/rustc_expand/src/config.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use rustc_ast::{
1111
use rustc_attr as attr;
1212
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1313
use rustc_feature::{
14-
ACCEPTED_FEATURES, AttributeSafety, Features, REMOVED_FEATURES, UNSTABLE_FEATURES,
14+
ACCEPTED_LANG_FEATURES, AttributeSafety, Features, REMOVED_LANG_FEATURES,
15+
UNSTABLE_LANG_FEATURES,
1516
};
1617
use rustc_lint_defs::BuiltinLintDiag;
1718
use rustc_parse::validate_attr;
@@ -77,7 +78,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
7778
};
7879

7980
// If the enabled feature has been removed, issue an error.
80-
if let Some(f) = REMOVED_FEATURES.iter().find(|f| name == f.feature.name) {
81+
if let Some(f) = REMOVED_LANG_FEATURES.iter().find(|f| name == f.feature.name) {
8182
sess.dcx().emit_err(FeatureRemoved {
8283
span: mi.span(),
8384
reason: f.reason.map(|reason| FeatureRemovedReason { reason }),
@@ -86,7 +87,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
8687
}
8788

8889
// If the enabled feature is stable, record it.
89-
if let Some(f) = ACCEPTED_FEATURES.iter().find(|f| name == f.name) {
90+
if let Some(f) = ACCEPTED_LANG_FEATURES.iter().find(|f| name == f.name) {
9091
let since = Some(Symbol::intern(f.since));
9192
features.set_enabled_lang_feature(name, mi.span(), since);
9293
continue;
@@ -103,7 +104,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
103104
}
104105

105106
// If the enabled feature is unstable, record it.
106-
if UNSTABLE_FEATURES.iter().find(|f| name == f.name).is_some() {
107+
if UNSTABLE_LANG_FEATURES.iter().find(|f| name == f.name).is_some() {
107108
// When the ICE comes from core, alloc or std (approximation of the standard
108109
// library), there's a chance that the person hitting the ICE may be using
109110
// -Zbuild-std or similar with an untested target. The bug is probably in the

Diff for: compiler/rustc_feature/src/accepted.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ macro_rules! declare_features {
99
$(#[doc = $doc:tt])* (accepted, $feature:ident, $ver:expr, $issue:expr),
1010
)+) => {
1111
/// Formerly unstable features that have now been accepted (stabilized).
12-
pub const ACCEPTED_FEATURES: &[Feature] = &[
12+
pub const ACCEPTED_LANG_FEATURES: &[Feature] = &[
1313
$(Feature {
1414
name: sym::$feature,
1515
since: $ver,

Diff for: compiler/rustc_feature/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ impl UnstableFeatures {
9494

9595
fn find_lang_feature_issue(feature: Symbol) -> Option<NonZero<u32>> {
9696
// Search in all the feature lists.
97-
if let Some(f) = UNSTABLE_FEATURES.iter().find(|f| f.name == feature) {
97+
if let Some(f) = UNSTABLE_LANG_FEATURES.iter().find(|f| f.name == feature) {
9898
return f.issue;
9999
}
100-
if let Some(f) = ACCEPTED_FEATURES.iter().find(|f| f.name == feature) {
100+
if let Some(f) = ACCEPTED_LANG_FEATURES.iter().find(|f| f.name == feature) {
101101
return f.issue;
102102
}
103-
if let Some(f) = REMOVED_FEATURES.iter().find(|f| f.feature.name == feature) {
103+
if let Some(f) = REMOVED_LANG_FEATURES.iter().find(|f| f.feature.name == feature) {
104104
return f.feature.issue;
105105
}
106106
panic!("feature `{feature}` is not declared anywhere");
@@ -127,12 +127,12 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option<NonZero<u
127127
}
128128
}
129129

130-
pub use accepted::ACCEPTED_FEATURES;
130+
pub use accepted::ACCEPTED_LANG_FEATURES;
131131
pub use builtin_attrs::{
132132
AttributeDuplicates, AttributeGate, AttributeSafety, AttributeTemplate, AttributeType,
133133
BUILTIN_ATTRIBUTE_MAP, BUILTIN_ATTRIBUTES, BuiltinAttribute, GatedCfg, deprecated_attributes,
134134
encode_cross_crate, find_gated_cfg, is_builtin_attr_name, is_stable_diagnostic_attribute,
135135
is_valid_for_get_attr,
136136
};
137-
pub use removed::REMOVED_FEATURES;
138-
pub use unstable::{Features, INCOMPATIBLE_FEATURES, UNSTABLE_FEATURES};
137+
pub use removed::REMOVED_LANG_FEATURES;
138+
pub use unstable::{Features, INCOMPATIBLE_FEATURES, UNSTABLE_LANG_FEATURES};

Diff for: compiler/rustc_feature/src/removed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ macro_rules! declare_features {
1414
$(#[doc = $doc:tt])* (removed, $feature:ident, $ver:expr, $issue:expr, $reason:expr),
1515
)+) => {
1616
/// Formerly unstable features that have now been removed.
17-
pub const REMOVED_FEATURES: &[RemovedFeature] = &[
17+
pub const REMOVED_LANG_FEATURES: &[RemovedFeature] = &[
1818
$(RemovedFeature {
1919
feature: Feature {
2020
name: sym::$feature,

Diff for: compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ macro_rules! declare_features {
7878
)+) => {
7979
/// Unstable language features that are being implemented or being
8080
/// considered for acceptance (stabilization) or removal.
81-
pub const UNSTABLE_FEATURES: &[Feature] = &[
81+
pub const UNSTABLE_LANG_FEATURES: &[Feature] = &[
8282
$(Feature {
8383
name: sym::$feature,
8484
since: $ver,

Diff for: compiler/rustc_passes/src/stability.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_attr::{
1010
};
1111
use rustc_data_structures::fx::FxIndexMap;
1212
use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet};
13-
use rustc_feature::ACCEPTED_FEATURES;
13+
use rustc_feature::ACCEPTED_LANG_FEATURES;
1414
use rustc_hir as hir;
1515
use rustc_hir::def::{DefKind, Res};
1616
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalModDefId};
@@ -248,7 +248,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
248248
}
249249

250250
if let Stability { level: Unstable { .. }, feature } = stab {
251-
if ACCEPTED_FEATURES.iter().find(|f| f.name == feature).is_some() {
251+
if ACCEPTED_LANG_FEATURES.iter().find(|f| f.name == feature).is_some() {
252252
self.tcx
253253
.dcx()
254254
.emit_err(errors::UnstableAttrForAlreadyStableFeature { span, item_sp });
@@ -261,7 +261,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
261261
}
262262

263263
if let Some(ConstStability { level: Unstable { .. }, feature, .. }) = const_stab {
264-
if ACCEPTED_FEATURES.iter().find(|f| f.name == feature).is_some() {
264+
if ACCEPTED_LANG_FEATURES.iter().find(|f| f.name == feature).is_some() {
265265
self.tcx.dcx().emit_err(errors::UnstableAttrForAlreadyStableFeature {
266266
span: const_span.unwrap(), // If const_stab contains Some(..), same is true for const_span
267267
item_sp,

Diff for: compiler/rustc_query_system/src/ich/impls_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features {
116116
self.enabled_lib_features().hash_stable(hcx, hasher);
117117

118118
// FIXME: why do we hash something that is a compile-time constant?
119-
for feature in rustc_feature::UNSTABLE_FEATURES.iter() {
119+
for feature in rustc_feature::UNSTABLE_LANG_FEATURES.iter() {
120120
feature.name.hash_stable(hcx, hasher);
121121
}
122122
}

0 commit comments

Comments
 (0)