Move some field extraction logic onto a method on Node
This commit is contained in:
parent
30ff127036
commit
cb161e77ba
2 changed files with 26 additions and 7 deletions
|
@ -177,13 +177,9 @@ fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [
|
|||
}
|
||||
}
|
||||
DefKind::AssocTy | DefKind::AssocConst => {
|
||||
let span = match tcx.hir().get_by_def_id(item) {
|
||||
rustc_hir::Node::ImplItem(it) => match it.kind {
|
||||
rustc_hir::ImplItemKind::Const(ty, _) => ty.span,
|
||||
rustc_hir::ImplItemKind::Type(ty) => ty.span,
|
||||
other => span_bug!(tcx.def_span(item), "{other:#?}"),
|
||||
},
|
||||
other => span_bug!(tcx.def_span(item), "{other:#?}"),
|
||||
let span = match tcx.hir().get_by_def_id(item).ty() {
|
||||
Some(ty) => ty.span,
|
||||
_ => tcx.def_span(item),
|
||||
};
|
||||
collector.visit_spanned(span, tcx.type_of(item).subst_identity());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue