05748c66a0
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 |
||
---|---|---|
.. | ||
coverage | ||
inline | ||
abort_unwinding_calls.rs | ||
add_call_guards.rs | ||
add_moves_for_packed_drops.rs | ||
add_retag.rs | ||
check_const_item_mutation.rs | ||
check_packed_ref.rs | ||
check_unsafety.rs | ||
cleanup_post_borrowck.rs | ||
const_debuginfo.rs | ||
const_goto.rs | ||
const_prop_lint.rs | ||
const_prop.rs | ||
copy_prop.rs | ||
ctfe_limit.rs | ||
dataflow_const_prop.rs | ||
dead_store_elimination.rs | ||
deduce_param_attrs.rs | ||
deduplicate_blocks.rs | ||
deref_separator.rs | ||
dest_prop.rs | ||
dump_mir.rs | ||
early_otherwise_branch.rs | ||
elaborate_box_derefs.rs | ||
elaborate_drops.rs | ||
ffi_unwind_calls.rs | ||
function_item_references.rs | ||
generator.rs | ||
inline.rs | ||
instcombine.rs | ||
lib.rs | ||
lower_intrinsics.rs | ||
lower_slice_len.rs | ||
match_branches.rs | ||
multiple_return_terminators.rs | ||
normalize_array_len.rs | ||
nrvo.rs | ||
pass_manager.rs | ||
remove_noop_landing_pads.rs | ||
remove_storage_markers.rs | ||
remove_uninit_drops.rs | ||
remove_unneeded_drops.rs | ||
remove_zsts.rs | ||
required_consts.rs | ||
reveal_all.rs | ||
separate_const_switch.rs | ||
shim.rs | ||
simplify_branches.rs | ||
simplify_comparison_integral.rs | ||
simplify.rs | ||
sroa.rs | ||
ssa.rs | ||
uninhabited_enum_branching.rs | ||
unreachable_prop.rs |