Skip to content

Commit c298744

Browse files
committed
Remove hir::StructField::attrs.
1 parent 3c0afc3 commit c298744

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
802802
self.lower_ty(&f.ty, ImplTraitContext::disallowed())
803803
};
804804
let hir_id = self.lower_node_id(f.id);
805+
self.lower_attrs(hir_id, &f.attrs);
805806
hir::StructField {
806807
span: f.span,
807808
hir_id,
@@ -812,7 +813,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
812813
},
813814
vis: self.lower_visibility(&f.vis, None),
814815
ty,
815-
attrs: self.lower_attrs(hir_id, &f.attrs),
816816
}
817817
}
818818

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,6 @@ pub struct StructField<'hir> {
26312631
pub vis: Visibility<'hir>,
26322632
pub hir_id: HirId,
26332633
pub ty: &'hir Ty<'hir>,
2634-
pub attrs: &'hir [Attribute],
26352634
}
26362635

26372636
impl StructField<'_> {

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ impl<'a> State<'a> {
888888
self.popen();
889889
self.commasep(Inconsistent, struct_def.fields(), |s, field| {
890890
s.maybe_print_comment(field.span.lo());
891-
s.print_outer_attributes(&field.attrs);
891+
s.print_outer_attributes(s.attrs(field.hir_id));
892892
s.print_visibility(&field.vis);
893893
s.print_type(&field.ty)
894894
});
@@ -910,7 +910,7 @@ impl<'a> State<'a> {
910910
for field in struct_def.fields() {
911911
self.hardbreak_if_not_bol();
912912
self.maybe_print_comment(field.span.lo());
913-
self.print_outer_attributes(&field.attrs);
913+
self.print_outer_attributes(self.attrs(field.hir_id));
914914
self.print_visibility(&field.vis);
915915
self.print_ident(field.ident);
916916
self.word_nbsp(":");

compiler/rustc_save_analysis/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ impl<'tcx> SaveContext<'tcx> {
387387

388388
let id = id_from_def_id(field_def_id);
389389
let span = self.span_from_span(field.ident.span);
390+
let attrs = self.tcx.hir().attrs(field.hir_id);
390391

391392
Some(Def {
392393
kind: DefKind::Field,
@@ -398,9 +399,9 @@ impl<'tcx> SaveContext<'tcx> {
398399
parent: Some(id_from_def_id(scope_def_id)),
399400
children: vec![],
400401
decl_id: None,
401-
docs: self.docs_for_attrs(&field.attrs),
402+
docs: self.docs_for_attrs(attrs),
402403
sig: sig::field_signature(field, self),
403-
attributes: lower_attributes(field.attrs.to_vec(), self),
404+
attributes: lower_attributes(attrs.to_vec(), self),
404405
})
405406
}
406407

src/tools/clippy/clippy_lints/src/missing_doc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
187187

188188
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {
189189
if !sf.is_positional() {
190-
self.check_missing_docs_attrs(cx, &sf.attrs, sf.span, "a", "struct field");
190+
let attrs = cx.tcx.hir().attrs(sf.hir_id);
191+
self.check_missing_docs_attrs(cx, attrs, sf.span, "a", "struct field");
191192
}
192193
}
193194

0 commit comments

Comments
 (0)