mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Remove hir::StructField::attrs.
This commit is contained in:
parent
3c0afc3e1c
commit
c298744da7
@ -802,6 +802,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||||||
self.lower_ty(&f.ty, ImplTraitContext::disallowed())
|
self.lower_ty(&f.ty, ImplTraitContext::disallowed())
|
||||||
};
|
};
|
||||||
let hir_id = self.lower_node_id(f.id);
|
let hir_id = self.lower_node_id(f.id);
|
||||||
|
self.lower_attrs(hir_id, &f.attrs);
|
||||||
hir::StructField {
|
hir::StructField {
|
||||||
span: f.span,
|
span: f.span,
|
||||||
hir_id,
|
hir_id,
|
||||||
@ -812,7 +813,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||||||
},
|
},
|
||||||
vis: self.lower_visibility(&f.vis, None),
|
vis: self.lower_visibility(&f.vis, None),
|
||||||
ty,
|
ty,
|
||||||
attrs: self.lower_attrs(hir_id, &f.attrs),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2631,7 +2631,6 @@ pub struct StructField<'hir> {
|
|||||||
pub vis: Visibility<'hir>,
|
pub vis: Visibility<'hir>,
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub ty: &'hir Ty<'hir>,
|
pub ty: &'hir Ty<'hir>,
|
||||||
pub attrs: &'hir [Attribute],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StructField<'_> {
|
impl StructField<'_> {
|
||||||
|
@ -888,7 +888,7 @@ impl<'a> State<'a> {
|
|||||||
self.popen();
|
self.popen();
|
||||||
self.commasep(Inconsistent, struct_def.fields(), |s, field| {
|
self.commasep(Inconsistent, struct_def.fields(), |s, field| {
|
||||||
s.maybe_print_comment(field.span.lo());
|
s.maybe_print_comment(field.span.lo());
|
||||||
s.print_outer_attributes(&field.attrs);
|
s.print_outer_attributes(s.attrs(field.hir_id));
|
||||||
s.print_visibility(&field.vis);
|
s.print_visibility(&field.vis);
|
||||||
s.print_type(&field.ty)
|
s.print_type(&field.ty)
|
||||||
});
|
});
|
||||||
@ -910,7 +910,7 @@ impl<'a> State<'a> {
|
|||||||
for field in struct_def.fields() {
|
for field in struct_def.fields() {
|
||||||
self.hardbreak_if_not_bol();
|
self.hardbreak_if_not_bol();
|
||||||
self.maybe_print_comment(field.span.lo());
|
self.maybe_print_comment(field.span.lo());
|
||||||
self.print_outer_attributes(&field.attrs);
|
self.print_outer_attributes(self.attrs(field.hir_id));
|
||||||
self.print_visibility(&field.vis);
|
self.print_visibility(&field.vis);
|
||||||
self.print_ident(field.ident);
|
self.print_ident(field.ident);
|
||||||
self.word_nbsp(":");
|
self.word_nbsp(":");
|
||||||
|
@ -387,6 +387,7 @@ impl<'tcx> SaveContext<'tcx> {
|
|||||||
|
|
||||||
let id = id_from_def_id(field_def_id);
|
let id = id_from_def_id(field_def_id);
|
||||||
let span = self.span_from_span(field.ident.span);
|
let span = self.span_from_span(field.ident.span);
|
||||||
|
let attrs = self.tcx.hir().attrs(field.hir_id);
|
||||||
|
|
||||||
Some(Def {
|
Some(Def {
|
||||||
kind: DefKind::Field,
|
kind: DefKind::Field,
|
||||||
@ -398,9 +399,9 @@ impl<'tcx> SaveContext<'tcx> {
|
|||||||
parent: Some(id_from_def_id(scope_def_id)),
|
parent: Some(id_from_def_id(scope_def_id)),
|
||||||
children: vec![],
|
children: vec![],
|
||||||
decl_id: None,
|
decl_id: None,
|
||||||
docs: self.docs_for_attrs(&field.attrs),
|
docs: self.docs_for_attrs(attrs),
|
||||||
sig: sig::field_signature(field, self),
|
sig: sig::field_signature(field, self),
|
||||||
attributes: lower_attributes(field.attrs.to_vec(), self),
|
attributes: lower_attributes(attrs.to_vec(), self),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
|||||||
|
|
||||||
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {
|
fn check_struct_field(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::StructField<'_>) {
|
||||||
if !sf.is_positional() {
|
if !sf.is_positional() {
|
||||||
self.check_missing_docs_attrs(cx, &sf.attrs, sf.span, "a", "struct field");
|
let attrs = cx.tcx.hir().attrs(sf.hir_id);
|
||||||
|
self.check_missing_docs_attrs(cx, attrs, sf.span, "a", "struct field");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user