mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Remove hir::MacroDef::attrs.
This commit is contained in:
parent
fd8a021757
commit
c05c90275c
@ -221,12 +221,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
if let ItemKind::MacroDef(MacroDef { ref body, macro_rules }) = i.kind {
|
||||
if !macro_rules || self.sess.contains_name(&i.attrs, sym::macro_export) {
|
||||
let hir_id = self.lower_node_id(i.id);
|
||||
let attrs = self.lower_attrs(hir_id, &i.attrs);
|
||||
self.lower_attrs(hir_id, &i.attrs);
|
||||
let body = P(self.lower_mac_args(body));
|
||||
self.exported_macros.push(hir::MacroDef {
|
||||
ident,
|
||||
vis,
|
||||
attrs,
|
||||
def_id: hir_id.expect_owner(),
|
||||
span: i.span,
|
||||
ast: MacroDef { body, macro_rules },
|
||||
|
@ -768,7 +768,6 @@ impl Crate<'_> {
|
||||
pub struct MacroDef<'hir> {
|
||||
pub ident: Ident,
|
||||
pub vis: Visibility<'hir>,
|
||||
pub attrs: &'hir [Attribute],
|
||||
pub def_id: LocalDefId,
|
||||
pub span: Span,
|
||||
pub ast: ast::MacroDef,
|
||||
|
@ -206,11 +206,10 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Item<'_> {
|
||||
|
||||
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for MacroDef<'_> {
|
||||
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
|
||||
let MacroDef { ident, ref attrs, def_id: _, ref ast, ref vis, span } = *self;
|
||||
let MacroDef { ident, def_id: _, ref ast, ref vis, span } = *self;
|
||||
|
||||
hcx.hash_hir_item_like(|hcx| {
|
||||
ident.name.hash_stable(hcx, hasher);
|
||||
attrs.hash_stable(hcx, hasher);
|
||||
ast.hash_stable(hcx, hasher);
|
||||
vis.hash_stable(hcx, hasher);
|
||||
span.hash_stable(hcx, hasher);
|
||||
|
@ -568,7 +568,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||
self.check_missing_docs_attrs(cx, hir::CRATE_HIR_ID, krate.item.span, "the", "crate");
|
||||
|
||||
for macro_def in krate.exported_macros {
|
||||
let has_doc = macro_def.attrs.iter().any(|a| has_doc(cx.sess(), a));
|
||||
let attrs = cx.tcx.hir().attrs(macro_def.hir_id());
|
||||
let has_doc = attrs.iter().any(|a| has_doc(cx.sess(), a));
|
||||
if !has_doc {
|
||||
cx.struct_span_lint(
|
||||
MISSING_DOCS,
|
||||
|
@ -881,7 +881,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
|
||||
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
|
||||
// Non-opaque macros cannot make other items more accessible than they already are.
|
||||
if attr::find_transparency(&self.tcx.sess, &md.attrs, md.ast.macro_rules).0
|
||||
let attrs = self.tcx.hir().attrs(md.hir_id());
|
||||
if attr::find_transparency(&self.tcx.sess, &attrs, md.ast.macro_rules).0
|
||||
!= Transparency::Opaque
|
||||
{
|
||||
// `#[macro_export]`-ed `macro_rules!` are `Public` since they
|
||||
|
Loading…
Reference in New Issue
Block a user