rust/compiler
Matthias Krüger 67d8999d17
Rollup merge of #118516 - celinval:smir-variants, r=ouz-a
Add ADT variant infomation to StableMIR and finish implementing TyKind::internal()

Introduce a `VariantDef` type and a mechanism to retrieve the definition from an `AdtDef`.

The `VariantDef` representation itself is just a combination of `AdtDef` and `VariantIdx`, which allow us to retrieve further information of a variant. I don't think we need to cache extra information for now, and we can translate on an on demand manner. I am  leaving the fields public today due to https://github.com/rust-lang/project-stable-mir/issues/56, but they shouldn't. For this PR, I've only added a method to retrieve the variant name, and its fields. I also added an implementation of `RustcInternal` that allow users to retrieve more information using Rust internal APIs.

I have also finished the implementation of `RustcInternal` for `TyKind` which fixes https://github.com/rust-lang/project-stable-mir/issues/46.

## Motivation

Both of these changes are needed in order to properly interpret things like projections. For example,
- The variant definition is used to find out which variant we are downcasting to.
- Being able to create `Ty` from `TyKind` helps for example processing each stage of a projection, like the code in `place.ty()`.
2023-12-06 17:21:58 +01:00
..
rustc
rustc_abi Rename LayoutCalculator::delay_bug as LayoutCalculator::delayed_bug. 2023-12-02 09:01:34 +11:00
rustc_arena Document reentrancy in *Arena::alloc_from_iter 2023-12-04 02:24:10 +01:00
rustc_ast Address code review feedback 2023-12-04 14:33:46 -08:00
rustc_ast_lowering Address code review feedback 2023-12-04 14:33:46 -08:00
rustc_ast_passes Address code review feedback 2023-12-04 14:33:46 -08:00
rustc_ast_pretty Option<CoroutineKind> 2023-12-04 13:03:37 -08:00
rustc_attr Use Session::diagnostic in more places. 2023-12-02 09:01:35 +11:00
rustc_baked_icu_data
rustc_borrowck Provide more suggestions for cloning immutable bindings 2023-12-04 21:54:34 +00:00
rustc_builtin_macros Auto merge of #118655 - compiler-errors:rollup-vrngyzn, r=compiler-errors 2023-12-06 04:20:51 +00:00
rustc_codegen_cranelift Give Handler::fatal and Session::fatal the same return type. 2023-12-04 15:42:06 +11:00
rustc_codegen_gcc Rename some arguments. 2023-12-04 18:57:41 +11:00
rustc_codegen_llvm Rollup merge of #118587 - nnethercote:cleanup-error-handlers-2, r=compiler-errors 2023-12-05 14:52:44 -05:00
rustc_codegen_ssa Rollup merge of #118573 - petrochenkov:pathdatakind, r=TaKO8Ki 2023-12-04 21:19:45 +09:00
rustc_const_eval Rollup merge of #118565 - RalfJung:numeric_intrinsic, r=davidtwco 2023-12-04 20:46:09 +01:00
rustc_data_structures jobserver: check file descriptors 2023-11-29 18:00:03 +03:00
rustc_driver
rustc_driver_impl rustc_driver_impl: Address all rustc::potential_query_instability lints 2023-12-05 06:19:14 +01:00
rustc_error_codes Yeet E0744 2023-11-28 20:40:38 +00:00
rustc_error_messages
rustc_errors Inline and remove fatal_no_raise. 2023-12-04 18:57:42 +11:00
rustc_expand Auto merge of #118655 - compiler-errors:rollup-vrngyzn, r=compiler-errors 2023-12-06 04:20:51 +00:00
rustc_feature Rollup merge of #118123 - RalfJung:internal-lib-features, r=compiler-errors 2023-12-05 14:52:41 -05:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Lower return types for gen fn to impl Iterator 2023-12-04 11:23:05 -08:00
rustc_hir_analysis Auto merge of #117661 - TheLazyDutchman:point_out_shadowed_associated_types, r=petrochenkov 2023-12-06 10:59:24 +00:00
rustc_hir_pretty Add never_patterns feature gate 2023-11-29 03:58:29 +01:00
rustc_hir_typeck Auto merge of #118655 - compiler-errors:rollup-vrngyzn, r=compiler-errors 2023-12-06 04:20:51 +00:00
rustc_incremental Rename HandlerInner::delayed_span_bugs as HandlerInner::span_delayed_bugs. 2023-12-02 09:01:34 +11:00
rustc_index
rustc_index_macros
rustc_infer Add print_trait_sugared 2023-12-05 17:15:46 +00:00
rustc_interface rustc_interface: Address all rustc::potential_query_instability lints 2023-12-05 06:33:38 +01:00
rustc_lexer
rustc_lint Option<CoroutineKind> 2023-12-04 13:03:37 -08:00
rustc_lint_defs vis note for no pub reexports glob import 2023-12-01 12:10:07 +08:00
rustc_llvm Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelix 2023-12-01 21:45:18 +00:00
rustc_log
rustc_macros
rustc_metadata Auto merge of #118488 - andjo403:remove_deadlock, r=SparrowLii 2023-12-05 14:02:15 +00:00
rustc_middle Add print_trait_sugared 2023-12-05 17:15:46 +00:00
rustc_mir_build Rollup merge of #118598 - Nadrieril:remove_precise_pointer_size_matching, r=davidtwco 2023-12-05 16:08:35 +01:00
rustc_mir_dataflow
rustc_mir_transform Auto merge of #118595 - Zalathar:visible-macro, r=TaKO8Ki 2023-12-06 14:01:21 +00:00
rustc_monomorphize
rustc_parse Auto merge of #118655 - compiler-errors:rollup-vrngyzn, r=compiler-errors 2023-12-06 04:20:51 +00:00
rustc_parse_format
rustc_passes Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
rustc_privacy Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors 2023-12-02 02:48:34 +00:00
rustc_query_impl QueryContext: rename try_collect_active_jobs -> collect_active_jobs and change it's return type from Option<QueryMap> to QueryMap 2023-11-27 18:13:15 +03:00
rustc_query_system Rollup merge of #118123 - RalfJung:internal-lib-features, r=compiler-errors 2023-12-05 14:52:41 -05:00
rustc_resolve Auto merge of #118457 - eholk:genfn, r=compiler-errors 2023-12-05 18:37:15 +00:00
rustc_serialize
rustc_session Rollup merge of #118587 - nnethercote:cleanup-error-handlers-2, r=compiler-errors 2023-12-05 14:52:44 -05:00
rustc_smir Change ty_with_args to return Ty instead of Result 2023-12-05 12:03:44 -08:00
rustc_span Detect incorrect ; in Option::ok_or_else and Result::map_err 2023-12-05 22:24:29 +00:00
rustc_symbol_mangling rustc_symbol_mangling: Address all rustc::potential_query_instability lints 2023-12-05 06:41:23 +01:00
rustc_target Rollup merge of #117874 - esp-rs:riscv3264imafc-unknown-none-elf, r=davidtwco 2023-12-06 17:21:57 +01:00
rustc_trait_selection Rollup merge of #116496 - estebank:question-method-chain-context, r=compiler-errors 2023-12-06 17:21:56 +01:00
rustc_traits
rustc_transmute
rustc_ty_utils Rollup merge of #118573 - petrochenkov:pathdatakind, r=TaKO8Ki 2023-12-04 21:19:45 +09:00
rustc_type_ir
stable_mir Change ty_with_args to return Ty instead of Result 2023-12-05 12:03:44 -08:00