Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions compiler/rustc_attr_parsing/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ use crate::{AttributeParser, ShouldEmit};

#[macro_export]
macro_rules! unstable {
($feat: ident $(, $notes:expr)*) => {
($feat: ident $(, $notes:expr)*) => {{
// Check that the feature exists
_ = rustc_feature::Features::$feat;

AttributeStability::Unstable {
gate_name: rustc_span::sym::$feat,
gate_check: rustc_feature::Features::$feat,
notes: &[$($notes),*],
}
};
}};
}

impl<'sess> AttributeParser<'sess> {
Expand All @@ -27,12 +29,11 @@ impl<'sess> AttributeParser<'sess> {
return;
}

let AttributeStability::Unstable { gate_check, gate_name, notes } = expected_stability
else {
let AttributeStability::Unstable { gate_name, notes } = expected_stability else {
return;
};

if gate_check(self.features()) || attr_span.allows_unstable(gate_name) {
if self.features().enabled(gate_name) || attr_span.allows_unstable(gate_name) {
return;
}

Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ pub enum AttributeStability {
Unstable {
/// The feature gate, for example `rustc_attrs` for rustc_* attributes.
gate_name: Symbol,
/// Check function to be called during the `PostExpansionVisitor` pass, which will be one
/// of the `Features::*` functions
gate_check: GateFn,
/// Notes to be displayed when an attempt is made to use the attribute without its feature
/// gate.
notes: &'static [&'static str],
Expand Down
Loading