1
Fork 0

Encode cross-crate opaque type origin

This commit is contained in:
Michael Goulet 2024-10-02 23:16:31 -04:00
parent 4add5e4211
commit e093b82a41
19 changed files with 53 additions and 43 deletions

View file

@ -384,7 +384,10 @@ impl<T> Trait<T> for X {
| DefKind::AssocFn
| DefKind::AssocConst
)
&& tcx.is_type_alias_impl_trait(opaque_ty.def_id)
&& matches!(
tcx.opaque_ty_origin(opaque_ty.def_id),
hir::OpaqueTyOrigin::TyAlias { .. }
)
&& !tcx
.opaque_types_defined_by(body_owner_def_id.expect_local())
.contains(&opaque_ty.def_id.expect_local())

View file

@ -2648,7 +2648,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
obligation: &PredicateObligation<'tcx>,
def_id: DefId,
) -> ErrorGuaranteed {
let name = match self.tcx.opaque_type_origin(def_id.expect_local()) {
let name = match self.tcx.local_opaque_ty_origin(def_id.expect_local()) {
hir::OpaqueTyOrigin::FnReturn { .. } | hir::OpaqueTyOrigin::AsyncFn { .. } => {
"opaque type".to_string()
}