Skip to content

Commit 11d632f

Browse files
committed
Auto merge of rust-lang#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 (rust-lang#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 rust-lang#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.
2 parents cbd6159 + e6ef478 commit 11d632f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/manual_non_exhaustive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
157157
&& def.variants.len() > 1
158158
{
159159
let mut iter = def.variants.iter().filter_map(|v| {
160-
let id = cx.tcx.hir().local_def_id(v.id);
161-
(matches!(v.data, hir::VariantData::Unit(_))
160+
let id = cx.tcx.hir().local_def_id(v.hir_id);
161+
(matches!(v.data, hir::VariantData::Unit(..))
162162
&& v.ident.as_str().starts_with('_')
163-
&& is_doc_hidden(cx.tcx.hir().attrs(v.id)))
163+
&& is_doc_hidden(cx.tcx.hir().attrs(v.hir_id)))
164164
.then_some((id, v.span))
165165
});
166166
if let Some((id, span)) = iter.next()

clippy_lints/src/missing_doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
199199
}
200200

201201
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx hir::Variant<'_>) {
202-
let attrs = cx.tcx.hir().attrs(v.id);
202+
let attrs = cx.tcx.hir().attrs(v.hir_id);
203203
if !is_from_proc_macro(cx, v) {
204204
self.check_missing_docs_attrs(cx, attrs, v.span, "a", "variant");
205205
}

0 commit comments

Comments
 (0)