Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
This commit is contained in:
commit
11d632f7b1
@ -157,10 +157,10 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
|
|||||||
&& def.variants.len() > 1
|
&& def.variants.len() > 1
|
||||||
{
|
{
|
||||||
let mut iter = def.variants.iter().filter_map(|v| {
|
let mut iter = def.variants.iter().filter_map(|v| {
|
||||||
let id = cx.tcx.hir().local_def_id(v.id);
|
let id = cx.tcx.hir().local_def_id(v.hir_id);
|
||||||
(matches!(v.data, hir::VariantData::Unit(_))
|
(matches!(v.data, hir::VariantData::Unit(..))
|
||||||
&& v.ident.as_str().starts_with('_')
|
&& v.ident.as_str().starts_with('_')
|
||||||
&& is_doc_hidden(cx.tcx.hir().attrs(v.id)))
|
&& is_doc_hidden(cx.tcx.hir().attrs(v.hir_id)))
|
||||||
.then_some((id, v.span))
|
.then_some((id, v.span))
|
||||||
});
|
});
|
||||||
if let Some((id, span)) = iter.next()
|
if let Some((id, span)) = iter.next()
|
||||||
|
@ -199,7 +199,7 @@ fn check_field_def(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::FieldDef<'_
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx hir::Variant<'_>) {
|
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx hir::Variant<'_>) {
|
||||||
let attrs = cx.tcx.hir().attrs(v.id);
|
let attrs = cx.tcx.hir().attrs(v.hir_id);
|
||||||
if !is_from_proc_macro(cx, v) {
|
if !is_from_proc_macro(cx, v) {
|
||||||
self.check_missing_docs_attrs(cx, attrs, v.span, "a", "variant");
|
self.check_missing_docs_attrs(cx, attrs, v.span, "a", "variant");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user