use ItemId.def_id and avoid fetching Item
This commit is contained in:
parent
f983d2658b
commit
0b38596e88
@ -1787,10 +1787,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
FxHashMap::default();
|
||||
|
||||
for id in tcx.hir().items() {
|
||||
match tcx.hir().def_kind(id.def_id) {
|
||||
DefKind::Impl => {
|
||||
let item = tcx.hir().item(id);
|
||||
if let Some(trait_ref) = tcx.impl_trait_ref(item.def_id.to_def_id()) {
|
||||
if matches!(tcx.hir().def_kind(id.def_id), DefKind::Impl) {
|
||||
if let Some(trait_ref) = tcx.impl_trait_ref(id.def_id.to_def_id()) {
|
||||
let simplified_self_ty = fast_reject::simplify_type(
|
||||
self.tcx,
|
||||
trait_ref.self_ty(),
|
||||
@ -1800,11 +1798,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
fx_hash_map
|
||||
.entry(trait_ref.def_id)
|
||||
.or_default()
|
||||
.push((item.def_id.local_def_index, simplified_self_ty));
|
||||
.push((id.def_id.local_def_index, simplified_self_ty));
|
||||
}
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
|
||||
let mut all_impls: Vec<_> = fx_hash_map.into_iter().collect();
|
||||
|
Loading…
x
Reference in New Issue
Block a user