rust/compiler/rustc_mir_dataflow/src
Matthias Krüger 05748c66a0
Rollup merge of #107271 - Zeegomo:drop-rmw, r=oli-obk
Treat Drop as a rmw operation

Previously, a Drop terminator was considered a move in MIR. This commit changes the behavior to only treat Drop as a mutable access to the dropped place.

In order for this change to be correct, we need to guarantee that

1.  A dropped value won't be used again
   2.  Places that appear in a drop won't be used again before a
     subsequent initialization.

We can ensure this to be correct at MIR construction because Drop will only be emitted when a variable goes out of scope, thus having:
*   (1) as there is no way of reaching the old value. drop-elaboration
     will also remove any uninitialized drop.
 * (2) as the place can't be named following the end of the scope.

However, the initialization status, previously tracked by moves, should also be tied to the execution of a Drop, hence the additional logic in the dataflow analyses.

From discussion in [this thread](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/.60DROP.60.20to.20.60DROP_IF.60.20compiler-team.23558), originating from https://github.com/rust-lang/compiler-team/issues/558.
See also https://github.com/rust-lang/rust/pull/104488#discussion_r1085556010
2023-02-08 18:32:41 +01:00
..
framework Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
impls Create stable metric to measure long computation in Const Eval 2023-01-23 23:56:22 +00:00
move_paths Rollup merge of #107271 - Zeegomo:drop-rmw, r=oli-obk 2023-02-08 18:32:41 +01:00
drop_flag_effects.rs Treat Drop as a rmw operation 2023-01-30 00:20:40 +01:00
elaborate_drops.rs Remove one more usage of mk_substs_trait 2022-12-14 15:36:39 +00:00
errors.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
lib.rs Add initial version of value analysis and dataflow constant propagation 2022-11-07 10:35:08 +01:00
rustc_peek.rs Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk 2022-08-29 06:34:43 +02:00
storage.rs Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
un_derefer.rs Auto merge of #99667 - ouz-a:some_branch, r=oli-obk 2022-07-29 07:11:50 +00:00
value_analysis.rs Rollup merge of #107271 - Zeegomo:drop-rmw, r=oli-obk 2023-02-08 18:32:41 +01:00