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();
|
FxHashMap::default();
|
||||||
|
|
||||||
for id in tcx.hir().items() {
|
for id in tcx.hir().items() {
|
||||||
match tcx.hir().def_kind(id.def_id) {
|
if matches!(tcx.hir().def_kind(id.def_id), DefKind::Impl) {
|
||||||
DefKind::Impl => {
|
if let Some(trait_ref) = tcx.impl_trait_ref(id.def_id.to_def_id()) {
|
||||||
let item = tcx.hir().item(id);
|
|
||||||
if let Some(trait_ref) = tcx.impl_trait_ref(item.def_id.to_def_id()) {
|
|
||||||
let simplified_self_ty = fast_reject::simplify_type(
|
let simplified_self_ty = fast_reject::simplify_type(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
trait_ref.self_ty(),
|
trait_ref.self_ty(),
|
||||||
@ -1800,11 +1798,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||||||
fx_hash_map
|
fx_hash_map
|
||||||
.entry(trait_ref.def_id)
|
.entry(trait_ref.def_id)
|
||||||
.or_default()
|
.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();
|
let mut all_impls: Vec<_> = fx_hash_map.into_iter().collect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user