rust/compiler
Dylan DPC c78e3c735a
Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obk
Handle discriminant in DataflowConstProp

cc ``@jachris``
r? ``@JakobDegen``

This PR attempts to extend the DataflowConstProp pass to handle propagation of discriminants. We handle this by adding 2 new variants to `TrackElem`: `TrackElem::Variant` for enum variants and `TrackElem::Discriminant` for the enum discriminant pseudo-place.

The difficulty is that the enum discriminant and enum variants may alias each another. This is the issue of the `Option<NonZeroUsize>` test, which is the equivalent of https://github.com/rust-lang/unsafe-code-guidelines/issues/84 with a direct write.

To handle that, we generalize the flood process to flood all the potentially aliasing places. In particular:
- any write to `(PLACE as Variant)`, either direct or through a projection, floods `(PLACE as OtherVariant)` for all other variants and `discriminant(PLACE)`;
- `SetDiscriminant(PLACE)` floods `(PLACE as Variant)` for each variant.

This implies that flooding is not hierarchical any more, and that an assignment to a non-tracked place may need to flood a tracked place. This is handled by `for_each_aliasing_place` which generalizes `preorder_invoke`.

As we deaggregate enums by putting `SetDiscriminant` last, this allows to propagate the value of the discriminant.

This refactor will allow to make https://github.com/rust-lang/rust/pull/107009 able to handle discriminants too.
2023-02-15 12:24:55 +05:30
..
rustc Add a new rustc_driver dylib to rexport rustc_driver_impl 2023-02-02 07:34:41 +01:00
rustc_abi Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki 2023-02-15 12:24:54 +05:30
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 rustc_ast: Merge impls and reorder methods for attributes and meta items 2023-02-11 23:23:17 +04:00
rustc_ast_lowering remove unused imports 2023-02-06 17:40:18 +03:00
rustc_ast_passes Autoderive ExternBlockSuggestion 2023-01-19 13:52:15 +01:00
rustc_ast_pretty Expand const-if-const trait bounds correctly 2023-02-07 21:00:12 +00:00
rustc_attr Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_baked_icu_data update ICU4X to 1.1.0 2023-02-04 22:28:59 +01:00
rustc_borrowck Rollup merge of #105300 - aliemjay:member-lower, r=oli-obk 2023-02-15 12:24:53 +05:30
rustc_builtin_macros Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_codegen_cranelift s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_gcc s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_llvm Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_codegen_ssa s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_const_eval Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_data_structures Refactor refcounted structural_impls via functors 2023-02-14 12:14:58 +00:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_error_codes Add extended error message for E0523 2023-02-06 06:58:30 -05:00
rustc_error_messages Rollup merge of #107673 - lukas-code:update-icu4x, r=davidtwco 2023-02-14 18:24:41 +01:00
rustc_errors Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_expand Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_feature change the marker attribute to only_local 2023-02-14 12:18:33 +01:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_hir_analysis Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_hir_pretty Use Mutability::{is_mut, is_not} 2023-01-30 12:26:26 +00:00
rustc_hir_typeck s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_incremental incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
rustc_index Fix IndexVec::drain_enumerated 2023-01-19 15:25:33 +00:00
rustc_infer Rollup merge of #107173 - clubby789:suggest-array-length, r=compiler-errors 2023-02-15 12:24:54 +05:30
rustc_interface rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_lexer Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
rustc_lint Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_lint_defs Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_llvm Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
rustc_log Rollup merge of #107895 - matthiaskrgr:cl, r=compiler-errors 2023-02-11 17:18:44 +01:00
rustc_macros Use derive attributes for uninteresting traversals 2023-02-14 15:09:40 +00:00
rustc_metadata rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_middle Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obk 2023-02-15 12:24:55 +05:30
rustc_mir_build s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_mir_dataflow Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obk 2023-02-15 12:24:55 +05:30
rustc_mir_transform Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obk 2023-02-15 12:24:55 +05:30
rustc_monomorphize Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
rustc_parse Rollup merge of #103478 - SpanishPear:spanishpear/issue_103366_fix, r=TaKO8Ki 2023-02-14 18:02:50 +01:00
rustc_parse_format remove redundant clones 2023-02-10 18:08:25 +01:00
rustc_passes add a #[rustc_coinductive] attribute 2023-02-14 11:53:22 +01:00
rustc_plugin_impl
rustc_privacy Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
rustc_query_impl Simplify tls::enter_context. 2023-02-09 15:25:45 +11:00
rustc_query_system Create a single value cache for the () query key 2023-02-11 23:38:01 +01:00
rustc_resolve rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_save_analysis Review changes 2023-01-31 07:54:01 +00:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_smir
rustc_span add a #[rustc_coinductive] attribute 2023-02-14 11:53:22 +01:00
rustc_symbol_mangling Pre-intern some commonly used type variables. 2023-02-13 09:25:36 +11:00
rustc_target Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki 2023-02-15 12:24:54 +05:30
rustc_trait_selection Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_traits Rename folder traits' tcx method to interner 2023-02-13 10:24:51 +00:00
rustc_transmute s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_ty_utils Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki 2023-02-15 12:24:54 +05:30
rustc_type_ir Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00