rust/compiler/rustc_metadata/src/rmeta
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
..
decoder Move the untracked cstore and source_span into a struct 2022-12-09 14:53:24 +00:00
decoder.rs Make some diagnostics not depend on the source of what they reference being available 2022-12-13 09:48:22 +00:00
def_path_hash_map.rs Use delayed error handling for Encodable and Encoder infallible. 2022-06-08 07:01:26 +10:00
encoder.rs Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
mod.rs Make inferred_outlives_crate return Clause 2022-11-29 12:01:58 -03:00
table.rs compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00