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`
This commit is contained in:
bors 2022-03-04 05:49:14 +00:00
commit 65f6d33b77
133 changed files with 530 additions and 510 deletions

View file

@ -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.