rust/compiler/rustc_borrowck/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
..
constraints lint auto pass 2022-11-09 20:42:16 +08:00
diagnostics Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
region_infer Add more regression tests 2022-11-21 20:16:36 +00:00
type_check Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
borrow_set.rs rustc_borrowck: remove ref patterns 2022-12-06 14:45:58 +00:00
borrowck_errors.rs struct error E0505 2022-11-09 21:15:31 +08:00
constraint_generation.rs lint auto pass 2022-11-09 20:42:16 +08:00
consumers.rs lint auto pass 2022-11-09 20:42:16 +08:00
dataflow.rs rustc_borrowck: remove ref patterns 2022-12-06 14:45:58 +00:00
def_use.rs lint auto pass 2022-11-09 20:42:16 +08:00
facts.rs lint auto pass 2022-11-09 20:42:16 +08:00
invalidation.rs Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
lib.rs Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
location.rs lint auto pass 2022-11-09 20:42:16 +08:00
member_constraints.rs Give precendence to regions from member constaints when inferring concrete types. 2022-11-14 21:24:18 +00:00
nll.rs Create format_args as late as possible 2022-12-01 08:49:51 +00:00
path_utils.rs lint auto pass 2022-11-09 20:42:16 +08:00
place_ext.rs lint auto pass 2022-11-09 20:42:16 +08:00
places_conflict.rs OpaqueCast projections are always overlapping, they can't possibly be disjoint 2022-11-23 14:37:13 +00:00
prefixes.rs lint auto pass 2022-11-09 20:42:16 +08:00
renumber.rs lint auto pass 2022-11-09 20:42:16 +08:00
session_diagnostics.rs struct error E0505 2022-11-09 21:15:31 +08:00
universal_regions.rs rustc_borrowck: remove ref patterns 2022-12-06 14:45:58 +00:00
used_muts.rs lint auto pass 2022-11-09 20:42:16 +08:00