1
Fork 0

Remove hir::Item::attrs.

This commit is contained in:
Camille GILLOT 2021-01-24 13:17:54 +01:00
parent 5474f17011
commit c701872a6c
32 changed files with 104 additions and 76 deletions

View file

@ -1466,11 +1466,12 @@ impl intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
if self.span.map_or(true, |span| item.span < span) {
if !item.span.from_expansion() {
// Don't insert between attributes and an item.
if item.attrs.is_empty() {
let attrs = self.tcx.hir().attrs(item.hir_id());
if attrs.is_empty() {
self.span = Some(item.span.shrink_to_lo());
} else {
// Find the first attribute on the item.
for attr in item.attrs {
for attr in attrs {
if self.span.map_or(true, |span| attr.span < span) {
self.span = Some(attr.span.shrink_to_lo());
}

View file

@ -201,7 +201,8 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: LocalDefId) {
error = true;
}
for attr in it.attrs {
let attrs = tcx.hir().attrs(main_id);
for attr in attrs {
if tcx.sess.check_name(attr, sym::track_caller) {
tcx.sess
.struct_span_err(
@ -300,7 +301,8 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: LocalDefId) {
error = true;
}
for attr in it.attrs {
let attrs = tcx.hir().attrs(start_id);
for attr in attrs {
if tcx.sess.check_name(attr, sym::track_caller) {
tcx.sess
.struct_span_err(