Access attrs directly from HirId in rustc_passes::stability.
This commit is contained in:
parent
0c883504fb
commit
f8514aaa56
1 changed files with 1 additions and 12 deletions
|
@ -97,7 +97,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
||||||
fn annotate<F>(
|
fn annotate<F>(
|
||||||
&mut self,
|
&mut self,
|
||||||
hir_id: HirId,
|
hir_id: HirId,
|
||||||
attrs: &[Attribute],
|
|
||||||
item_sp: Span,
|
item_sp: Span,
|
||||||
kind: AnnotationKind,
|
kind: AnnotationKind,
|
||||||
inherit_deprecation: InheritDeprecation,
|
inherit_deprecation: InheritDeprecation,
|
||||||
|
@ -107,6 +106,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
||||||
) where
|
) where
|
||||||
F: FnOnce(&mut Self),
|
F: FnOnce(&mut Self),
|
||||||
{
|
{
|
||||||
|
let attrs = self.tcx.hir().attrs(hir_id);
|
||||||
debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs);
|
debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs);
|
||||||
let mut did_error = false;
|
let mut did_error = false;
|
||||||
if !self.tcx.features().staged_api {
|
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() {
|
if let Some(ctor_hir_id) = sd.ctor_hir_id() {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
ctor_hir_id,
|
ctor_hir_id,
|
||||||
&i.attrs,
|
|
||||||
i.span,
|
i.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
InheritDeprecation::Yes,
|
||||||
|
@ -400,7 +399,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||||
|
|
||||||
self.annotate(
|
self.annotate(
|
||||||
i.hir_id(),
|
i.hir_id(),
|
||||||
&i.attrs,
|
|
||||||
i.span,
|
i.span,
|
||||||
kind,
|
kind,
|
||||||
InheritDeprecation::Yes,
|
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>) {
|
fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
ti.hir_id(),
|
ti.hir_id(),
|
||||||
&ti.attrs,
|
|
||||||
ti.span,
|
ti.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
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 };
|
if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required };
|
||||||
self.annotate(
|
self.annotate(
|
||||||
ii.hir_id(),
|
ii.hir_id(),
|
||||||
&ii.attrs,
|
|
||||||
ii.span,
|
ii.span,
|
||||||
kind,
|
kind,
|
||||||
InheritDeprecation::Yes,
|
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) {
|
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
var.id,
|
var.id,
|
||||||
&var.attrs,
|
|
||||||
var.span,
|
var.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
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() {
|
if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
|
||||||
v.annotate(
|
v.annotate(
|
||||||
ctor_hir_id,
|
ctor_hir_id,
|
||||||
&var.attrs,
|
|
||||||
var.span,
|
var.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
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>) {
|
fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
s.hir_id,
|
s.hir_id,
|
||||||
&s.attrs,
|
|
||||||
s.span,
|
s.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
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>) {
|
fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
i.hir_id(),
|
i.hir_id(),
|
||||||
&i.attrs,
|
|
||||||
i.span,
|
i.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
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>) {
|
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
|
||||||
self.annotate(
|
self.annotate(
|
||||||
md.hir_id(),
|
md.hir_id(),
|
||||||
&md.attrs,
|
|
||||||
md.span,
|
md.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
InheritDeprecation::Yes,
|
||||||
|
@ -525,7 +516,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||||
|
|
||||||
self.annotate(
|
self.annotate(
|
||||||
p.hir_id,
|
p.hir_id,
|
||||||
&p.attrs,
|
|
||||||
p.span,
|
p.span,
|
||||||
kind,
|
kind,
|
||||||
InheritDeprecation::No,
|
InheritDeprecation::No,
|
||||||
|
@ -696,7 +686,6 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> {
|
||||||
|
|
||||||
annotator.annotate(
|
annotator.annotate(
|
||||||
hir::CRATE_HIR_ID,
|
hir::CRATE_HIR_ID,
|
||||||
&krate.item.attrs,
|
|
||||||
krate.item.span,
|
krate.item.span,
|
||||||
AnnotationKind::Required,
|
AnnotationKind::Required,
|
||||||
InheritDeprecation::Yes,
|
InheritDeprecation::Yes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue