rust/compiler
bors 7b3cd075bb Auto merge of #90788 - ecstatic-morse:issue-90752, r=wesleywiser
Mark places as initialized when mutably borrowed

Fixes the example in #90752, but does not handle some corner cases involving raw pointers and unsafe. See [this comment](https://github.com/rust-lang/rust/issues/90752#issuecomment-965822895) for more information, or the second test.

Although I talked about both `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` in #90752, this PR only changes the latter. That's because "maybe uninitialized" is the conservative choice, and marking them as definitely initialized (`!maybe_uninitialized`) when a mutable borrow is created could lead to problems if `addr_of_mut` to an uninitialized local is allowed. Additionally, places cannot become uninitialized via a mutable reference, so if a place is definitely initialized, taking a mutable reference to it should not change that.

I think it's correct to ignore interior mutability as nbdd0121 suggests below. Their analysis doesn't work inside of `core::cell`, which *does* have access to `UnsafeCell`'s field, but that won't be an issue unless we explicitly instantiate one with an `enum` within that module.

r? `@wesleywiser`
2021-11-23 17:44:33 +00:00
..
rustc Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_apfloat Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_arena Add some comments. 2021-11-19 07:52:59 +11:00
rustc_ast Auto merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieu 2021-11-12 16:29:25 +00:00
rustc_ast_lowering Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_ast_passes rustc_feature: Convert BuiltinAttribute from tuple to a struct 2021-11-12 20:15:14 +08:00
rustc_ast_pretty Add support for specifying multiple clobber_abi in asm! 2021-11-10 01:06:03 -05:00
rustc_attr Correct typo 2021-10-16 13:36:05 -07:00
rustc_borrowck Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_builtin_macros Stabilize format_args_capture 2021-11-15 10:14:29 +01:00
rustc_codegen_cranelift Make hash_result an Option. 2021-10-20 18:29:18 +02:00
rustc_codegen_gcc Remove workaround for the forward progress handling in LLVM 2021-11-14 16:35:09 +01:00
rustc_codegen_llvm add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_codegen_ssa Rollup merge of #90900 - andjo403:removeLlvm12Check, r=nikic 2021-11-17 15:58:05 +01:00
rustc_const_eval Revert "require full validity when determining the discriminant of a value" 2021-11-20 12:33:04 -05:00
rustc_data_structures Add #[inline]s to SortedIndexMultiMap 2021-11-11 08:35:59 +09:00
rustc_driver add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_error_codes Update Copy/Clone documentation WRT arrays 2021-11-08 13:11:59 -05:00
rustc_errors Align multiline messages to their label (add left margin) 2021-11-20 19:19:33 +00:00
rustc_expand Stabilize format_args_capture 2021-11-15 10:14:29 +01:00
rustc_feature Check for duplicate attributes. 2021-11-18 16:10:26 -08:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_hir Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_hir_pretty Auto merge of #89124 - cjgillot:owner-info, r=michaelwoerister 2021-10-18 19:53:05 +00:00
rustc_incremental Add -Zassert-incr-state to assert state of incremental cache 2021-11-12 13:41:46 -06:00
rustc_index Generate documentation in rustc rustc_index::newtype_index macro 2021-11-13 18:50:29 -06:00
rustc_infer Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_interface add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_lexer use matches!() macro in more places 2021-11-06 16:13:14 +01:00
rustc_lint Stabilize format_args_capture 2021-11-15 10:14:29 +01:00
rustc_lint_defs Properly register text_direction_codepoint_in_comment lint. 2021-11-05 20:12:40 +01:00
rustc_llvm add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_macros Avoid generating empty closures for fieldless enums 2021-11-22 21:22:35 -05:00
rustc_metadata Add ty::Visibility::is_public() 2021-11-09 18:35:00 -08:00
rustc_middle Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_mir_build Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_mir_dataflow Auto merge of #90788 - ecstatic-morse:issue-90752, r=wesleywiser 2021-11-23 17:44:33 +00:00
rustc_mir_transform impl Copy/Clone for arrays in std, not in compiler 2021-11-08 13:11:58 -05:00
rustc_monomorphize Rollup merge of #90701 - michaelwoerister:more-artifact-sizes, r=davidtwco 2021-11-09 19:00:45 +01:00
rustc_parse Rollup merge of #90994 - Badel2:issue-90993, r=estebank 2021-11-20 22:33:49 +01:00
rustc_parse_format Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_passes Add checks for more empty attributes. 2021-11-18 16:10:28 -08:00
rustc_plugin_impl Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
rustc_privacy Add ty::Visibility::is_public() 2021-11-09 18:35:00 -08:00
rustc_query_impl Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_query_system Manually outline error on incremental_verify_ich 2021-11-22 21:32:20 -05:00
rustc_resolve Rollup merge of #90930 - Nilstrieb:fix-non-const-value-ice, r=estebank 2021-11-20 10:21:14 +01:00
rustc_save_analysis Give inline const separate DefKind 2021-11-07 03:59:06 +00:00
rustc_serialize Avoid generating empty closures for fieldless enums 2021-11-22 21:22:35 -05:00
rustc_session add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_span Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_symbol_mangling Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_target add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_trait_selection Simplify for loop desugar 2021-11-21 08:15:21 -06:00
rustc_traits Make select_* methods return Vec for TraitEngine 2021-11-08 23:35:23 +08:00
rustc_ty_utils Recurse through query system when checking ADT drop types, hopefully improving perf 2021-11-13 14:47:17 -05:00
rustc_type_ir Add two inline annotations for hot functions 2021-10-03 12:43:43 -04:00
rustc_typeck Auto merge of #88681 - ehuss:duplicate-attributes, r=petrochenkov 2021-11-22 02:15:25 +00:00