rust/compiler
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
..
rustc Add a new rustc_driver dylib to rexport rustc_driver_impl 2023-02-02 07:34:41 +01:00
rustc_abi also do not add noalias on not-Unpin Box 2023-02-06 12:17:41 +01:00
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 Rollup merge of #107544 - nnethercote:improve-TokenCursor, r=petrochenkov 2023-02-03 23:04:51 +05:30
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 remove unused imports 2023-02-06 17:40:18 +03:00
rustc_attr Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_baked_icu_data
rustc_borrowck Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgr 2023-02-07 20:58:20 +00:00
rustc_builtin_macros Don't generate unecessary &&self.field in deriving Debug 2023-02-02 22:06:23 +00:00
rustc_codegen_cranelift Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk 2023-01-29 04:11:27 +00:00
rustc_codegen_gcc session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
rustc_codegen_llvm remove unused imports 2023-02-06 17:40:18 +03:00
rustc_codegen_ssa remove unused imports 2023-02-06 17:40:18 +03:00
rustc_const_eval Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk 2023-02-08 07:13:26 +01:00
rustc_data_structures Make an optimal cold path for query_cache_hit 2023-02-06 15:22:12 +01:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Rollup merge of #107771 - estebank:ice-msg, r=compiler-errors 2023-02-08 07:13:27 +01:00
rustc_error_codes Add extended error message for E0523 2023-02-06 06:58:30 -05:00
rustc_error_messages Auto merge of #107727 - Dylan-DPC:rollup-b1yexcl, r=Dylan-DPC 2023-02-06 16:28:18 +00:00
rustc_errors Clean up and comment EmitterWriter.draw_code_line 2023-02-05 19:01:28 +01:00
rustc_expand rustc_expand: remove huge error imports 2023-02-05 03:47:22 +01:00
rustc_feature Auto merge of #107297 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini 2023-01-31 19:24:29 +00: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 Rename PointerSized to PointerLike 2023-02-07 19:05:53 +00:00
rustc_hir_analysis Rollup merge of #107555 - edward-shen:edward-shen/dup-trait-suggestion, r=compiler-errors 2023-02-07 17:57:14 +01:00
rustc_hir_pretty Use Mutability::{is_mut, is_not} 2023-01-30 12:26:26 +00:00
rustc_hir_typeck Rollup merge of #107779 - compiler-errors:issue-107775, r=jackh726 2023-02-08 07:13:29 +01: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 Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgr 2023-02-07 20:58:20 +00:00
rustc_interface remove unused imports 2023-02-06 17:40:18 +03:00
rustc_lexer Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
rustc_lint Auto merge of #103761 - chenyukang:yukang/fix-103320-must-use, r=compiler-errors 2023-02-06 12:57:37 +00:00
rustc_lint_defs make unaligned_reference a hard error 2023-01-31 20:28:11 +01:00
rustc_llvm llvm-16: Use Triple.h from new header location. 2023-02-07 06:51:58 -08:00
rustc_log Add log-backtrace option to show backtraces along with logging 2023-01-12 00:17:48 +09:00
rustc_macros Forbid #[suggestion_*(...)] on Vecs 2023-02-01 21:49:45 +01:00
rustc_metadata Rollup merge of #100599 - MatthewPeterKelly:add-E0523-description-and-test, r=compiler-errors,GuillaumeGomez 2023-02-07 17:57:13 +01:00
rustc_middle Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgr 2023-02-07 20:58:20 +00:00
rustc_mir_build remove unused imports 2023-02-06 17:40:18 +03:00
rustc_mir_dataflow Rollup merge of #107271 - Zeegomo:drop-rmw, r=oli-obk 2023-02-08 18:32:41 +01:00
rustc_mir_transform Rollup merge of #107271 - Zeegomo:drop-rmw, r=oli-obk 2023-02-08 18:32:41 +01:00
rustc_monomorphize Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errors 2023-01-31 10:20:58 +00:00
rustc_parse Rollup merge of #107580 - lenko-d:default_value_for_a_lifetime_generic_parameter_produces_confusing_diagnostic, r=compiler-errors 2023-02-06 19:54:14 +05:30
rustc_parse_format Rollup merge of #106805 - madsravn:master, r=compiler-errors 2023-02-03 06:30:23 +01:00
rustc_passes rustc_passes: remove huge error imports 2023-02-05 03:47:58 +01:00
rustc_plugin_impl
rustc_privacy remove unused imports 2023-02-06 17:40:18 +03:00
rustc_query_impl remove unused imports 2023-02-06 17:40:18 +03:00
rustc_query_system Make an optimal cold path for query_cache_hit 2023-02-06 15:22:12 +01:00
rustc_resolve Rename rust_2015 => is_rust_2015 2023-02-02 08:17:13 +00: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 Sort Generator print-type-sizes according to their yield points 2023-02-05 17:34:33 +01:00
rustc_smir
rustc_span Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk 2023-02-08 07:13:26 +01:00
rustc_symbol_mangling Introduce GeneratorWitnessMIR. 2023-01-27 18:58:44 +00:00
rustc_target Auto merge of #106925 - imWildCat:imWildCat/remove-hardcoded-ios-macbi-target-version, r=wesleywiser 2023-02-02 05:26:09 +00:00
rustc_trait_selection Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk 2023-02-08 07:13:26 +01:00
rustc_traits remove unused imports 2023-02-06 17:40:18 +03:00
rustc_transmute Also remove #![feature(control_flow_enum)] where possible 2023-01-18 10:22:21 -08:00
rustc_ty_utils Auto merge of #106180 - RalfJung:dereferenceable-generators, r=nbdd0121 2023-02-07 03:35:10 +00:00
rustc_type_ir ReErased regions are local 2023-02-05 15:29:07 +01:00