Skip to content

Commit f8514aa

Browse files
committed
Access attrs directly from HirId in rustc_passes::stability.
1 parent 0c88350 commit f8514aa

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

compiler/rustc_passes/src/stability.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
9797
fn annotate<F>(
9898
&mut self,
9999
hir_id: HirId,
100-
attrs: &[Attribute],
101100
item_sp: Span,
102101
kind: AnnotationKind,
103102
inherit_deprecation: InheritDeprecation,
@@ -107,6 +106,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
107106
) where
108107
F: FnOnce(&mut Self),
109108
{
109+
let attrs = self.tcx.hir().attrs(hir_id);
110110
debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs);
111111
let mut did_error = false;
112112
if !self.tcx.features().staged_api {
@@ -385,7 +385,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
385385
if let Some(ctor_hir_id) = sd.ctor_hir_id() {
386386
self.annotate(
387387
ctor_hir_id,
388-
&i.attrs,
389388
i.span,
390389
AnnotationKind::Required,
391390
InheritDeprecation::Yes,
@@ -400,7 +399,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
400399

401400
self.annotate(
402401
i.hir_id(),
403-
&i.attrs,
404402
i.span,
405403
kind,
406404
InheritDeprecation::Yes,
@@ -414,7 +412,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
414412
fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) {
415413
self.annotate(
416414
ti.hir_id(),
417-
&ti.attrs,
418415
ti.span,
419416
AnnotationKind::Required,
420417
InheritDeprecation::Yes,
@@ -431,7 +428,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
431428
if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required };
432429
self.annotate(
433430
ii.hir_id(),
434-
&ii.attrs,
435431
ii.span,
436432
kind,
437433
InheritDeprecation::Yes,
@@ -446,7 +442,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
446442
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
447443
self.annotate(
448444
var.id,
449-
&var.attrs,
450445
var.span,
451446
AnnotationKind::Required,
452447
InheritDeprecation::Yes,
@@ -456,7 +451,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
456451
if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
457452
v.annotate(
458453
ctor_hir_id,
459-
&var.attrs,
460454
var.span,
461455
AnnotationKind::Required,
462456
InheritDeprecation::Yes,
@@ -474,7 +468,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
474468
fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) {
475469
self.annotate(
476470
s.hir_id,
477-
&s.attrs,
478471
s.span,
479472
AnnotationKind::Required,
480473
InheritDeprecation::Yes,
@@ -489,7 +482,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
489482
fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) {
490483
self.annotate(
491484
i.hir_id(),
492-
&i.attrs,
493485
i.span,
494486
AnnotationKind::Required,
495487
InheritDeprecation::Yes,
@@ -504,7 +496,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
504496
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
505497
self.annotate(
506498
md.hir_id(),
507-
&md.attrs,
508499
md.span,
509500
AnnotationKind::Required,
510501
InheritDeprecation::Yes,
@@ -525,7 +516,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
525516

526517
self.annotate(
527518
p.hir_id,
528-
&p.attrs,
529519
p.span,
530520
kind,
531521
InheritDeprecation::No,
@@ -696,7 +686,6 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> {
696686

697687
annotator.annotate(
698688
hir::CRATE_HIR_ID,
699-
&krate.item.attrs,
700689
krate.item.span,
701690
AnnotationKind::Required,
702691
InheritDeprecation::Yes,

0 commit comments

Comments
 (0)