rust/compiler/rustc_mir_dataflow
Giacomo Pasini 68c1e2fd48
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
  a) A dropped value won't be used again
  b) 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:
  (a) as there is no way of reaching the old value. drop-elaboration
     will also remove any uninitialized drop.
  (b) 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.
2023-01-30 00:20:40 +01:00
..
src Treat Drop as a rmw operation 2023-01-30 00:20:40 +01:00
Cargo.toml Remove from compiler/ crates 2022-09-29 16:49:04 +09:00