Skip to content

Commit 8ba9137

Browse files
committed
Merge STABLE_REMOVED_FEATURES list into REMOVED_FEATURES.
There is a single features (`no_stack_check`) in `STABLE_REMOVED_FEATURES`. But the treatment of `STABLE_REMOVED_FEATURES` and `REMOVED_FEATURES` is actually identical. So this commit just merges them, and uses a comment to record `no_stack_check`'s unique "stable removed" status. This also lets `State::Stabilized` (which was a terrible name) be removed.
1 parent 5d9559e commit 8ba9137

File tree

3 files changed

+9
-35
lines changed

3 files changed

+9
-35
lines changed

compiler/rustc_expand/src/config.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ use rustc_attr as attr;
1515
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1616
use rustc_data_structures::fx::FxHashMap;
1717
use rustc_feature::{Feature, Features, State as FeatureState};
18-
use rustc_feature::{
19-
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
20-
};
18+
use rustc_feature::{ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES};
2119
use rustc_parse::validate_attr;
2220
use rustc_session::parse::feature_err;
2321
use rustc_session::Session;
@@ -154,12 +152,8 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
154152
}
155153

156154
// If the declared feature is removed, issue an error.
157-
let removed = REMOVED_FEATURES.iter().find(|f| name == f.name);
158-
let stable_removed = STABLE_REMOVED_FEATURES.iter().find(|f| name == f.name);
159-
if let Some(Feature { state, .. }) = removed.or(stable_removed) {
160-
if let FeatureState::Removed { reason } | FeatureState::Stabilized { reason } =
161-
state
162-
{
155+
if let Some(Feature { state, .. }) = REMOVED_FEATURES.iter().find(|f| name == f.name) {
156+
if let FeatureState::Removed { reason } = state {
163157
sess.emit_err(FeatureRemoved {
164158
span: mi.span(),
165159
reason: reason.map(|reason| FeatureRemovedReason { reason }),

compiler/rustc_feature/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub enum State {
3232
Accepted,
3333
Active { set: fn(&mut Features) },
3434
Removed { reason: Option<&'static str> },
35-
Stabilized { reason: Option<&'static str> },
3635
}
3736

3837
impl fmt::Debug for State {
@@ -41,7 +40,6 @@ impl fmt::Debug for State {
4140
State::Accepted { .. } => write!(f, "accepted"),
4241
State::Active { .. } => write!(f, "active"),
4342
State::Removed { .. } => write!(f, "removed"),
44-
State::Stabilized { .. } => write!(f, "stabilized"),
4543
}
4644
}
4745
}
@@ -113,7 +111,6 @@ fn find_lang_feature_issue(feature: Symbol) -> Option<NonZeroU32> {
113111
.chain(ACTIVE_FEATURES)
114112
.chain(ACCEPTED_FEATURES)
115113
.chain(REMOVED_FEATURES)
116-
.chain(STABLE_REMOVED_FEATURES)
117114
.find(|t| t.name == feature);
118115

119116
match found {
@@ -151,4 +148,4 @@ pub use builtin_attrs::{
151148
is_valid_for_get_attr, AttributeGate, AttributeTemplate, AttributeType, BuiltinAttribute,
152149
GatedCfg, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
153150
};
154-
pub use removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
151+
pub use removed::REMOVED_FEATURES;

compiler/rustc_feature/src/removed.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,6 @@ macro_rules! declare_features {
2020
),+
2121
];
2222
};
23-
24-
($(
25-
$(#[doc = $doc:tt])* (stable_removed, $feature:ident, $ver:expr, $issue:expr, None),
26-
)+) => {
27-
/// Represents stable features which have since been removed (it was once Accepted)
28-
pub const STABLE_REMOVED_FEATURES: &[Feature] = &[
29-
$(
30-
Feature {
31-
state: State::Stabilized { reason: None },
32-
name: sym::$feature,
33-
since: $ver,
34-
issue: to_nonzero($issue),
35-
edition: None,
36-
}
37-
),+
38-
];
39-
};
4023
}
4124

4225
#[rustfmt::skip]
@@ -141,6 +124,11 @@ declare_features! (
141124
(removed, no_coverage, "CURRENT_RUSTC_VERSION", Some(84605), None, Some("renamed to `coverage_attribute`")),
142125
/// Allows `#[no_debug]`.
143126
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
127+
/// Note: this feature was previously recorded in a separate
128+
/// `STABLE_REMOVED` list because it, uniquely, was once stable but was
129+
/// then removed. But there was no utility storing it separately, so now
130+
/// it's in this list.
131+
(removed, no_stack_check, "1.0.0", None, None, None),
144132
/// Allows using `#[on_unimplemented(..)]` on traits.
145133
/// (Moved to `rustc_attrs`.)
146134
(removed, on_unimplemented, "1.40.0", None, None, None),
@@ -208,8 +196,3 @@ declare_features! (
208196
// feature-group-end: removed features
209197
// -------------------------------------------------------------------------
210198
);
211-
212-
#[rustfmt::skip]
213-
declare_features! (
214-
(stable_removed, no_stack_check, "1.0.0", None, None),
215-
);

0 commit comments

Comments
 (0)