rust/compiler
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
..
rustc
rustc_abi minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_ast_lowering Rollup merge of #105464 - nbdd0121:hir, r=compiler-errors 2022-12-13 19:57:10 +01:00
rustc_ast_passes remove unnecessary uses of clone 2022-12-13 02:06:24 +09:00
rustc_ast_pretty Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_attr rustc_attr remove ref patterns 2022-12-06 14:45:58 +00:00
rustc_baked_icu_data Update crate documentation of rustc_baked_icu_data crate 2022-11-18 14:46:36 -08:00
rustc_borrowck Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_builtin_macros Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_codegen_cranelift bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
rustc_codegen_gcc Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa 2022-12-12 10:38:31 +00:00
rustc_codegen_llvm Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_codegen_ssa Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_const_eval Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_data_structures minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_driver compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_error_codes compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_error_messages Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa 2022-12-13 05:01:36 +00:00
rustc_errors Avoid rendering empty annotations 2022-12-13 10:06:08 +00:00
rustc_expand Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_feature Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3 2022-12-10 09:24:43 +01:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_hir minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_hir_analysis Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_hir_pretty Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_hir_typeck Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_incremental compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_index minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_infer Address a few more nits 2022-12-13 17:56:04 +00:00
rustc_interface compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_lexer minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_lint Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
rustc_lint_defs delete mentions of type ascription from lint descriptions 2022-12-12 17:43:15 +01:00
rustc_llvm llvm-wrapper: adapt for LLVM API changes 2022-12-11 09:14:50 +00:00
rustc_log
rustc_macros Auto merge of #105220 - oli-obk:feeding, r=cjgillot 2022-12-06 03:47:41 +00:00
rustc_metadata Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_middle Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_mir_build Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_mir_dataflow Don't require owned data in MaybeStorageLive 2022-12-13 04:22:47 -08:00
rustc_mir_transform Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_monomorphize bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
rustc_parse Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_parse_format Assert size of rustc_parse_format::Piece<'_> 2022-12-08 22:50:39 +00:00
rustc_passes Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk 2022-12-07 15:39:06 +01:00
rustc_plugin_impl
rustc_privacy Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_query_impl Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obk 2022-11-30 17:20:14 +00:00
rustc_query_system compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_resolve Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank 2022-12-13 01:17:08 +01:00
rustc_save_analysis compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_smir
rustc_span minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_symbol_mangling Combine identical alias arms 2022-12-13 17:48:55 +00:00
rustc_target compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_trait_selection Auto merge of #104986 - compiler-errors:opaques, r=oli-obk 2022-12-14 01:19:24 +00:00
rustc_traits Remove chalk lowering for AliasTy 2022-12-13 17:48:55 +00:00
rustc_transmute
rustc_ty_utils Combine identical alias arms 2022-12-13 17:48:55 +00:00
rustc_type_ir Combine identical alias arms 2022-12-13 17:48:55 +00:00