Skip to content

Commit 32716ae

Browse files
committed
Remove span from hir::MacroDef.
1 parent a295ae3 commit 32716ae

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
226226
ident,
227227
vis,
228228
def_id: hir_id.expect_owner(),
229-
span: i.span,
230229
ast: MacroDef { body, macro_rules },
231230
});
232231
} else {

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,6 @@ pub struct MacroDef<'hir> {
772772
pub ident: Ident,
773773
pub vis: Visibility<'hir>,
774774
pub def_id: LocalDefId,
775-
pub span: Span,
776775
pub ast: ast::MacroDef,
777776
}
778777

compiler/rustc_hir/src/stable_hash_impls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,12 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Item<'_> {
194194

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

199199
hcx.hash_hir_item_like(|hcx| {
200200
ident.name.hash_stable(hcx, hasher);
201201
ast.hash_stable(hcx, hasher);
202202
vis.hash_stable(hcx, hasher);
203-
span.hash_stable(hcx, hasher);
204203
});
205204
}
206205
}

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
572572
let attrs = cx.tcx.hir().attrs(macro_def.hir_id());
573573
let has_doc = attrs.iter().any(|a| has_doc(cx.sess(), a));
574574
if !has_doc {
575+
let span = cx.tcx.hir().span(macro_def.hir_id());
575576
cx.struct_span_lint(
576577
MISSING_DOCS,
577-
cx.tcx.sess.source_map().guess_head_span(macro_def.span),
578+
cx.tcx.sess.source_map().guess_head_span(span),
578579
|lint| lint.build("missing documentation for macro").emit(),
579580
);
580581
}

compiler/rustc_passes/src/check_attr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,8 @@ impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
12881288
}
12891289

12901290
fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef<'tcx>) {
1291-
self.check_attributes(macro_def.hir_id(), &macro_def.span, Target::MacroDef, None);
1291+
let span = self.tcx.hir().span(macro_def.hir_id());
1292+
self.check_attributes(macro_def.hir_id(), &span, Target::MacroDef, None);
12921293
intravisit::walk_macro_def(self, macro_def);
12931294
}
12941295

compiler/rustc_passes/src/stability.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,10 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
496496
}
497497

498498
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
499+
let span = self.tcx.hir().span(md.hir_id());
499500
self.annotate(
500501
md.hir_id(),
501-
md.span,
502+
span,
502503
AnnotationKind::Required,
503504
InheritDeprecation::Yes,
504505
InheritConstStability::No,
@@ -625,7 +626,8 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
625626
}
626627

627628
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
628-
self.check_missing_stability(md.hir_id(), md.span);
629+
let span = self.tcx.hir().span(md.hir_id());
630+
self.check_missing_stability(md.hir_id(), span);
629631
}
630632

631633
// Note that we don't need to `check_missing_stability` for default generic parameters,

src/librustdoc/doctest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
11001100
self.visit_testable(
11011101
macro_def.ident.to_string(),
11021102
macro_def.hir_id(),
1103-
macro_def.span,
1103+
self.map.span(macro_def.hir_id()),
11041104
|_| (),
11051105
);
11061106
}

0 commit comments

Comments
 (0)