diff options
| author | bors <bors@rust-lang.org> | 2022-03-04 05:49:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-04 05:49:14 +0000 |
| commit | 65f6d33b775eddfc0128c04083bbf3beea360114 (patch) | |
| tree | b1a38a27de70d46108d6679f217dcb45176a7b6e /compiler/rustc_feature | |
| parent | 8fa5d74a7cb01ceaf1a07aa6fcaf42137d8bda58 (diff) | |
| parent | c680d39b1ecf16d3ebd3338ea0193002dec611ac (diff) | |
| download | rust-65f6d33b775eddfc0128c04083bbf3beea360114.tar.gz rust-65f6d33b775eddfc0128c04083bbf3beea360114.zip | |
Auto merge of #94096 - cjgillot:ensure-stability, r=lcnr
Ensure stability directives are checked in all cases Split off #93017 Stability and deprecation were not checked in all cases, for instance if a type error happened. This PR moves the check earlier in the pipeline to ensure the errors are emitted in all cases. r? `@lcnr`
Diffstat (limited to 'compiler/rustc_feature')
| -rw-r--r-- | compiler/rustc_feature/src/active.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 1d9d16e85cb..1f7dc769512 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -2,6 +2,7 @@ use super::{to_nonzero, Feature, State}; +use rustc_data_structures::fx::FxHashSet; use rustc_span::edition::Edition; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; @@ -47,6 +48,8 @@ macro_rules! declare_features { pub declared_lang_features: Vec<(Symbol, Span, Option<Symbol>)>, /// `#![feature]` attrs for non-language (library) features. pub declared_lib_features: Vec<(Symbol, Span)>, + /// Features enabled for this crate. + pub active_features: FxHashSet<Symbol>, $( $(#[doc = $doc])* pub $feature: bool @@ -58,6 +61,11 @@ macro_rules! declare_features { $(f(stringify!($feature), self.$feature);)+ } + /// Is the given feature active? + pub fn active(&self, feature: Symbol) -> bool { + self.active_features.contains(&feature) + } + /// Is the given feature enabled? /// /// Panics if the symbol doesn't correspond to a declared feature. |
