RPITITs are DefKind::Opaque with new lowering strategy
This commit is contained in:
parent
c1f3529c91
commit
c3e6f68931
4 changed files with 36 additions and 15 deletions
|
@ -305,7 +305,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
|
|||
}) = item.kind
|
||||
{
|
||||
let substs = InternalSubsts::identity_for_item(tcx, def_id);
|
||||
let opaque_identity_ty = if in_trait {
|
||||
let opaque_identity_ty = if in_trait && !tcx.lower_impl_trait_in_trait_to_assoc_ty() {
|
||||
tcx.mk_projection(def_id.to_def_id(), substs)
|
||||
} else {
|
||||
tcx.mk_opaque(def_id.to_def_id(), substs)
|
||||
|
@ -554,7 +554,15 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
|
|||
check_union(tcx, id.owner_id.def_id);
|
||||
}
|
||||
DefKind::OpaqueTy => {
|
||||
check_opaque(tcx, id);
|
||||
let opaque = tcx.hir().expect_item(id.owner_id.def_id).expect_opaque_ty();
|
||||
if let hir::OpaqueTyOrigin::FnReturn(fn_def_id) | hir::OpaqueTyOrigin::AsyncFn(fn_def_id) = opaque.origin
|
||||
&& let hir::Node::TraitItem(trait_item) = tcx.hir().get_by_def_id(fn_def_id)
|
||||
&& let (_, hir::TraitFn::Required(..)) = trait_item.expect_fn()
|
||||
{
|
||||
// Skip opaques from RPIT in traits with no default body.
|
||||
} else {
|
||||
check_opaque(tcx, id);
|
||||
}
|
||||
}
|
||||
DefKind::ImplTraitPlaceholder => {
|
||||
let parent = tcx.impl_trait_in_trait_parent_fn(id.owner_id.to_def_id());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue