rust/compiler/rustc_metadata/src
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
..
rmeta Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
creader.rs Fold Definitions into the untracked data 2022-12-09 14:59:39 +00:00
dependency_format.rs Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco 2022-09-03 10:33:05 +05:30
errors.rs Fix CrateLocationUnknownType error 2022-11-20 10:48:37 +11:00
foreign_modules.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
fs.rs Use Symbol for the crate name instead of String/str 2022-12-07 20:30:02 +00:00
lib.rs Wrap bundlen static libraries into object files 2022-11-14 12:01:49 +03:00
locator.rs Tests for bad --extern library path and file 2022-11-22 17:44:38 +11:00
native_libs.rs Stabilize native library modifier verbatim 2022-11-27 22:36:32 +03:00