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.
This commit is contained in:
parent
5d9559e026
commit
8ba9137840
3 changed files with 9 additions and 35 deletions
|
@ -15,9 +15,7 @@ use rustc_attr as attr;
|
|||
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_feature::{Feature, Features, State as FeatureState};
|
||||
use rustc_feature::{
|
||||
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
|
||||
};
|
||||
use rustc_feature::{ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES};
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::Session;
|
||||
|
@ -154,12 +152,8 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
|
|||
}
|
||||
|
||||
// If the declared feature is removed, issue an error.
|
||||
let removed = REMOVED_FEATURES.iter().find(|f| name == f.name);
|
||||
let stable_removed = STABLE_REMOVED_FEATURES.iter().find(|f| name == f.name);
|
||||
if let Some(Feature { state, .. }) = removed.or(stable_removed) {
|
||||
if let FeatureState::Removed { reason } | FeatureState::Stabilized { reason } =
|
||||
state
|
||||
{
|
||||
if let Some(Feature { state, .. }) = REMOVED_FEATURES.iter().find(|f| name == f.name) {
|
||||
if let FeatureState::Removed { reason } = state {
|
||||
sess.emit_err(FeatureRemoved {
|
||||
span: mi.span(),
|
||||
reason: reason.map(|reason| FeatureRemovedReason { reason }),
|
||||
|
|
|
@ -32,7 +32,6 @@ pub enum State {
|
|||
Accepted,
|
||||
Active { set: fn(&mut Features) },
|
||||
Removed { reason: Option<&'static str> },
|
||||
Stabilized { reason: Option<&'static str> },
|
||||
}
|
||||
|
||||
impl fmt::Debug for State {
|
||||
|
@ -41,7 +40,6 @@ impl fmt::Debug for State {
|
|||
State::Accepted { .. } => write!(f, "accepted"),
|
||||
State::Active { .. } => write!(f, "active"),
|
||||
State::Removed { .. } => write!(f, "removed"),
|
||||
State::Stabilized { .. } => write!(f, "stabilized"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +111,6 @@ fn find_lang_feature_issue(feature: Symbol) -> Option<NonZeroU32> {
|
|||
.chain(ACTIVE_FEATURES)
|
||||
.chain(ACCEPTED_FEATURES)
|
||||
.chain(REMOVED_FEATURES)
|
||||
.chain(STABLE_REMOVED_FEATURES)
|
||||
.find(|t| t.name == feature);
|
||||
|
||||
match found {
|
||||
|
@ -151,4 +148,4 @@ pub use builtin_attrs::{
|
|||
is_valid_for_get_attr, AttributeGate, AttributeTemplate, AttributeType, BuiltinAttribute,
|
||||
GatedCfg, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
|
||||
};
|
||||
pub use removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
|
||||
pub use removed::REMOVED_FEATURES;
|
||||
|
|
|
@ -20,23 +20,6 @@ macro_rules! declare_features {
|
|||
),+
|
||||
];
|
||||
};
|
||||
|
||||
($(
|
||||
$(#[doc = $doc:tt])* (stable_removed, $feature:ident, $ver:expr, $issue:expr, None),
|
||||
)+) => {
|
||||
/// Represents stable features which have since been removed (it was once Accepted)
|
||||
pub const STABLE_REMOVED_FEATURES: &[Feature] = &[
|
||||
$(
|
||||
Feature {
|
||||
state: State::Stabilized { reason: None },
|
||||
name: sym::$feature,
|
||||
since: $ver,
|
||||
issue: to_nonzero($issue),
|
||||
edition: None,
|
||||
}
|
||||
),+
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
@ -141,6 +124,11 @@ declare_features! (
|
|||
(removed, no_coverage, "CURRENT_RUSTC_VERSION", Some(84605), None, Some("renamed to `coverage_attribute`")),
|
||||
/// Allows `#[no_debug]`.
|
||||
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
|
||||
/// Note: this feature was previously recorded in a separate
|
||||
/// `STABLE_REMOVED` list because it, uniquely, was once stable but was
|
||||
/// then removed. But there was no utility storing it separately, so now
|
||||
/// it's in this list.
|
||||
(removed, no_stack_check, "1.0.0", None, None, None),
|
||||
/// Allows using `#[on_unimplemented(..)]` on traits.
|
||||
/// (Moved to `rustc_attrs`.)
|
||||
(removed, on_unimplemented, "1.40.0", None, None, None),
|
||||
|
@ -208,8 +196,3 @@ declare_features! (
|
|||
// feature-group-end: removed features
|
||||
// -------------------------------------------------------------------------
|
||||
);
|
||||
|
||||
#[rustfmt::skip]
|
||||
declare_features! (
|
||||
(stable_removed, no_stack_check, "1.0.0", None, None),
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue