diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-11-12 20:15:14 +0800 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-11-12 20:15:14 +0800 |
| commit | 66557270419400a2d104833f3ff6dd6a55210543 (patch) | |
| tree | 631b73a25e051c4f6f4829de554add92f50374e4 /compiler/rustc_ast_passes | |
| parent | e4c23daeb461ac02413eb36c8cefcc5530638a05 (diff) | |
| download | rust-66557270419400a2d104833f3ff6dd6a55210543.tar.gz rust-66557270419400a2d104833f3ff6dd6a55210543.zip | |
rustc_feature: Convert `BuiltinAttribute` from tuple to a struct
Diffstat (limited to 'compiler/rustc_ast_passes')
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index f45a79f026f..b011a2e8117 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -3,7 +3,7 @@ use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use rustc_ast::{AssocTyConstraint, AssocTyConstraintKind, NodeId}; use rustc_ast::{PatKind, RangeEnd, VariantData}; use rustc_errors::struct_span_err; -use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; +use rustc_feature::{AttributeGate, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; use rustc_feature::{Features, GateIssue}; use rustc_session::parse::{feature_err, feature_err_issue}; use rustc_session::Session; @@ -301,11 +301,14 @@ impl<'a> PostExpansionVisitor<'a> { impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_attribute(&mut self, attr: &ast::Attribute) { - let attr_info = - attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name)).map(|a| **a); + let attr_info = attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name)); // Check feature gates for built-in attributes. - if let Some((.., AttributeGate::Gated(_, name, descr, has_feature))) = attr_info { - gate_feature_fn!(self, has_feature, attr.span, name, descr); + if let Some(BuiltinAttribute { + gate: AttributeGate::Gated(_, name, descr, has_feature), + .. + }) = attr_info + { + gate_feature_fn!(self, has_feature, attr.span, *name, descr); } // Check unstable flavors of the `#[doc]` attribute. if attr.has_name(sym::doc) { |
