Skip to content

Commit c05c902

Browse files
committed
Remove hir::MacroDef::attrs.
1 parent fd8a021 commit c05c902

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
221221
if let ItemKind::MacroDef(MacroDef { ref body, macro_rules }) = i.kind {
222222
if !macro_rules || self.sess.contains_name(&i.attrs, sym::macro_export) {
223223
let hir_id = self.lower_node_id(i.id);
224-
let attrs = self.lower_attrs(hir_id, &i.attrs);
224+
self.lower_attrs(hir_id, &i.attrs);
225225
let body = P(self.lower_mac_args(body));
226226
self.exported_macros.push(hir::MacroDef {
227227
ident,
228228
vis,
229-
attrs,
230229
def_id: hir_id.expect_owner(),
231230
span: i.span,
232231
ast: MacroDef { body, macro_rules },

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ impl Crate<'_> {
768768
pub struct MacroDef<'hir> {
769769
pub ident: Ident,
770770
pub vis: Visibility<'hir>,
771-
pub attrs: &'hir [Attribute],
772771
pub def_id: LocalDefId,
773772
pub span: Span,
774773
pub ast: ast::MacroDef,

compiler/rustc_hir/src/stable_hash_impls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,10 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Item<'_> {
206206

207207
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for MacroDef<'_> {
208208
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
209-
let MacroDef { ident, ref attrs, def_id: _, ref ast, ref vis, span } = *self;
209+
let MacroDef { ident, def_id: _, ref ast, ref vis, span } = *self;
210210

211211
hcx.hash_hir_item_like(|hcx| {
212212
ident.name.hash_stable(hcx, hasher);
213-
attrs.hash_stable(hcx, hasher);
214213
ast.hash_stable(hcx, hasher);
215214
vis.hash_stable(hcx, hasher);
216215
span.hash_stable(hcx, hasher);

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
568568
self.check_missing_docs_attrs(cx, hir::CRATE_HIR_ID, krate.item.span, "the", "crate");
569569

570570
for macro_def in krate.exported_macros {
571-
let has_doc = macro_def.attrs.iter().any(|a| has_doc(cx.sess(), a));
571+
let attrs = cx.tcx.hir().attrs(macro_def.hir_id());
572+
let has_doc = attrs.iter().any(|a| has_doc(cx.sess(), a));
572573
if !has_doc {
573574
cx.struct_span_lint(
574575
MISSING_DOCS,

compiler/rustc_privacy/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
881881

882882
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
883883
// Non-opaque macros cannot make other items more accessible than they already are.
884-
if attr::find_transparency(&self.tcx.sess, &md.attrs, md.ast.macro_rules).0
884+
let attrs = self.tcx.hir().attrs(md.hir_id());
885+
if attr::find_transparency(&self.tcx.sess, &attrs, md.ast.macro_rules).0
885886
!= Transparency::Opaque
886887
{
887888
// `#[macro_export]`-ed `macro_rules!` are `Public` since they

0 commit comments

Comments
 (0)