Auto merge of #104986 - compiler-errors:opaques, r=oli-obk
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias` Implements https://github.com/rust-lang/types-team/issues/79. This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so: ``` enum AliasKind { Projection, Opaque, } struct AliasTy<'tcx> { def_id: DefId, substs: SubstsRef<'tcx>, } ``` Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example: ```diff match ty.kind() { - ty::Opaque(..) => + ty::Alias(ty::Opaque, ..) => {} _ => {} } ``` This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically. r? `@ghost`
This commit is contained in:
commit
918d0ac38e
115 changed files with 632 additions and 674 deletions
|
@ -1111,8 +1111,8 @@ fn should_encode_trait_impl_trait_tys<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) ->
|
|||
// associated types.
|
||||
tcx.fn_sig(trait_item_def_id).skip_binder().output().walk().any(|arg| {
|
||||
if let ty::GenericArgKind::Type(ty) = arg.unpack()
|
||||
&& let ty::Projection(data) = ty.kind()
|
||||
&& tcx.def_kind(data.item_def_id) == DefKind::ImplTraitPlaceholder
|
||||
&& let ty::Alias(ty::Projection, data) = ty.kind()
|
||||
&& tcx.def_kind(data.def_id) == DefKind::ImplTraitPlaceholder
|
||||
{
|
||||
true
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue