rust/compiler/rustc_hir_analysis/src/collect
bors 918d0ac38e 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`
2022-12-14 01:19:24 +00:00
..
generics_of.rs Rollup merge of #105410 - TaKO8Ki:fix-105257, r=BoxyUwU 2022-12-10 15:01:44 +01:00
item_bounds.rs Introduce PredicateKind::Clause 2022-11-25 00:04:54 -03:00
lifetimes.rs Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
predicates_of.rs Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
type_of.rs Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00