Access attrs directly from HirId in rustc_passes::stability.

This commit is contained in:
Camille GILLOT 2020-11-26 23:25:07 +01:00
parent 0c883504fb
commit f8514aaa56

View File

@ -97,7 +97,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
fn annotate<F>(
&mut self,
hir_id: HirId,
attrs: &[Attribute],
item_sp: Span,
kind: AnnotationKind,
inherit_deprecation: InheritDeprecation,
@ -107,6 +106,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
) where
F: FnOnce(&mut Self),
{
let attrs = self.tcx.hir().attrs(hir_id);
debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs);
let mut did_error = false;
if !self.tcx.features().staged_api {
@ -385,7 +385,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
if let Some(ctor_hir_id) = sd.ctor_hir_id() {
self.annotate(
ctor_hir_id,
&i.attrs,
i.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -400,7 +399,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
self.annotate(
i.hir_id(),
&i.attrs,
i.span,
kind,
InheritDeprecation::Yes,
@ -414,7 +412,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) {
self.annotate(
ti.hir_id(),
&ti.attrs,
ti.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -431,7 +428,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required };
self.annotate(
ii.hir_id(),
&ii.attrs,
ii.span,
kind,
InheritDeprecation::Yes,
@ -446,7 +442,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
self.annotate(
var.id,
&var.attrs,
var.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -456,7 +451,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
v.annotate(
ctor_hir_id,
&var.attrs,
var.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -474,7 +468,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) {
self.annotate(
s.hir_id,
&s.attrs,
s.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -489,7 +482,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) {
self.annotate(
i.hir_id(),
&i.attrs,
i.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -504,7 +496,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
self.annotate(
md.hir_id(),
&md.attrs,
md.span,
AnnotationKind::Required,
InheritDeprecation::Yes,
@ -525,7 +516,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
self.annotate(
p.hir_id,
&p.attrs,
p.span,
kind,
InheritDeprecation::No,
@ -696,7 +686,6 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> {
annotator.annotate(
hir::CRATE_HIR_ID,
&krate.item.attrs,
krate.item.span,
AnnotationKind::Required,
InheritDeprecation::Yes,