mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Remove hir::Variant::attrs.
This commit is contained in:
parent
a0a4611a81
commit
3c0afc3e1c
@ -749,9 +749,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
|
||||
fn lower_variant(&mut self, v: &Variant) -> hir::Variant<'hir> {
|
||||
let id = self.lower_node_id(v.id);
|
||||
self.lower_attrs(id, &v.attrs);
|
||||
hir::Variant {
|
||||
id,
|
||||
attrs: self.lower_attrs(id, &v.attrs),
|
||||
data: self.lower_variant_data(id, &v.data),
|
||||
disr_expr: v.disr_expr.as_ref().map(|e| self.lower_anon_const(e)),
|
||||
ident: v.ident,
|
||||
|
@ -2538,8 +2538,6 @@ pub struct Variant<'hir> {
|
||||
/// Name of the variant.
|
||||
#[stable_hasher(project(name))]
|
||||
pub ident: Ident,
|
||||
/// Attributes of the variant.
|
||||
pub attrs: &'hir [Attribute],
|
||||
/// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
|
||||
pub id: HirId,
|
||||
/// Fields and constructor id of the variant.
|
||||
|
@ -834,7 +834,7 @@ impl<'a> State<'a> {
|
||||
for v in variants {
|
||||
self.space_if_not_bol();
|
||||
self.maybe_print_comment(v.span.lo());
|
||||
self.print_outer_attributes(&v.attrs);
|
||||
self.print_outer_attributes(self.attrs(v.id));
|
||||
self.ibox(INDENT_UNIT);
|
||||
self.print_variant(v);
|
||||
self.s.word(",");
|
||||
|
@ -554,6 +554,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
||||
let span = self.span_from_span(name_span);
|
||||
let id = id_from_hir_id(variant.id, &self.save_ctxt);
|
||||
let parent = Some(id_from_def_id(item.def_id.to_def_id()));
|
||||
let attrs = self.tcx.hir().attrs(variant.id);
|
||||
|
||||
self.dumper.dump_def(
|
||||
&access,
|
||||
@ -567,12 +568,9 @@ impl<'tcx> DumpVisitor<'tcx> {
|
||||
parent,
|
||||
children: vec![],
|
||||
decl_id: None,
|
||||
docs: self.save_ctxt.docs_for_attrs(&variant.attrs),
|
||||
docs: self.save_ctxt.docs_for_attrs(attrs),
|
||||
sig: sig::variant_signature(variant, &self.save_ctxt),
|
||||
attributes: lower_attributes(
|
||||
variant.attrs.to_vec(),
|
||||
&self.save_ctxt,
|
||||
),
|
||||
attributes: lower_attributes(attrs.to_vec(), &self.save_ctxt),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -594,6 +592,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
||||
let span = self.span_from_span(name_span);
|
||||
let id = id_from_hir_id(variant.id, &self.save_ctxt);
|
||||
let parent = Some(id_from_def_id(item.def_id.to_def_id()));
|
||||
let attrs = self.tcx.hir().attrs(variant.id);
|
||||
|
||||
self.dumper.dump_def(
|
||||
&access,
|
||||
@ -607,12 +606,9 @@ impl<'tcx> DumpVisitor<'tcx> {
|
||||
parent,
|
||||
children: vec![],
|
||||
decl_id: None,
|
||||
docs: self.save_ctxt.docs_for_attrs(&variant.attrs),
|
||||
docs: self.save_ctxt.docs_for_attrs(attrs),
|
||||
sig: sig::variant_signature(variant, &self.save_ctxt),
|
||||
attributes: lower_attributes(
|
||||
variant.attrs.to_vec(),
|
||||
&self.save_ctxt,
|
||||
),
|
||||
attributes: lower_attributes(attrs.to_vec(), &self.save_ctxt),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -192,6 +192,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||
}
|
||||
|
||||
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx hir::Variant<'_>) {
|
||||
self.check_missing_docs_attrs(cx, &v.attrs, v.span, "a", "variant");
|
||||
let attrs = cx.tcx.hir().attrs(v.id);
|
||||
self.check_missing_docs_attrs(cx, attrs, v.span, "a", "variant");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user