return Ok((self, false));
};
- let actual_parent = self.tcx().parent(def_id);
+ let actual_parent = self.tcx().opt_parent(def_id);
debug!(
"try_print_visible_def_path: visible_parent={:?} actual_parent={:?}",
visible_parent, actual_parent,
return Ok(self);
}
- let parent = self.tcx().parent(def_id).expect("opaque types always have a parent");
+ let parent = self.tcx().parent(def_id);
match self.tcx().def_kind(parent) {
DefKind::TyAlias | DefKind::AssocTy => {
if let ty::Opaque(d, _) = *self.tcx().type_of(parent).kind() {
// Iterate all local crate items no matter where they are defined.
let hir = tcx.hir();
for id in hir.items() {
- if matches!(hir.def_kind(id.def_id), DefKind::Use) {
+ if matches!(tcx.def_kind(id.def_id), DefKind::Use) {
continue;
}