Add of_trait
to DefKind::Impl.
This commit is contained in:
parent
9bb6e60d1f
commit
03dff82d59
28 changed files with 68 additions and 64 deletions
|
@ -1182,13 +1182,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
);
|
||||
}
|
||||
let parent_did = tcx.parent(method_did);
|
||||
let parent_self_ty = (tcx.def_kind(parent_did)
|
||||
== rustc_hir::def::DefKind::Impl)
|
||||
.then_some(parent_did)
|
||||
.and_then(|did| match tcx.type_of(did).kind() {
|
||||
ty::Adt(def, ..) => Some(def.did()),
|
||||
_ => None,
|
||||
});
|
||||
let parent_self_ty =
|
||||
matches!(tcx.def_kind(parent_did), rustc_hir::def::DefKind::Impl { .. })
|
||||
.then_some(parent_did)
|
||||
.and_then(|did| match tcx.type_of(did).kind() {
|
||||
ty::Adt(def, ..) => Some(def.did()),
|
||||
_ => None,
|
||||
});
|
||||
let is_option_or_result = parent_self_ty.map_or(false, |def_id| {
|
||||
matches!(tcx.get_diagnostic_name(def_id), Some(sym::Option | sym::Result))
|
||||
});
|
||||
|
|
|
@ -852,9 +852,9 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
|||
|
||||
let tcx = self.infcx.tcx;
|
||||
let region_parent = tcx.parent(region.def_id);
|
||||
if tcx.def_kind(region_parent) != DefKind::Impl {
|
||||
let DefKind::Impl { .. } = tcx.def_kind(region_parent) else {
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
let found = tcx
|
||||
.any_free_region_meets(&tcx.type_of(region_parent), |r| *r == ty::ReEarlyBound(region));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue