1
Fork 0
rust/compiler/rustc_mir_transform/src
bors b7583d38b7 Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726
generator layout: ignore fake borrows

fixes #117059

We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: fab1054e17/compiler/rustc_mir_build/src/build/matches/mod.rs (L1250-L1265)

These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards.

Only the second commit impacts behavior, and could be backported by itself.

r? types
2023-11-09 14:23:45 +00:00
..
coverage coverage: Replace impossible coverage::Error with assertions 2023-10-31 22:20:30 +11:00
inline subst -> instantiate 2023-09-26 09:37:55 +02:00
abort_unwinding_calls.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
add_call_guards.rs when terminating during unwinding, show the reason why 2023-08-24 13:28:26 +02:00
add_moves_for_packed_drops.rs Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
add_retag.rs cleanup misinformation regarding has_deref 2023-08-06 17:29:09 +03:00
add_subtyping_projections.rs move subtyper change reveal_all 2023-10-05 18:56:30 +03:00
check_alignment.rs Check alignment of pointers only when read/written through 2023-11-04 13:01:32 -04:00
check_const_item_mutation.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
check_packed_ref.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
check_unsafety.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
cleanup_post_borrowck.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
const_debuginfo.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
const_goto.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
const_prop.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
const_prop_lint.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
copy_prop.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
coroutine.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
cost_checker.rs Make instance an option in CostChecker. 2023-10-21 06:58:00 +00:00
cross_crate_inline.rs Add -Zcross-crate-inline-threshold=yes 2023-11-07 18:45:11 -05:00
ctfe_limit.rs Simplify back-edge logic. 2023-05-17 12:18:55 +00:00
dataflow_const_prop.rs Update MIR tests for offset_of 2023-10-31 23:26:02 +00:00
dead_store_elimination.rs Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
deduce_param_attrs.rs deduce_param_attrs: explain a read-only case 2023-10-30 10:29:08 +01:00
deduplicate_blocks.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
deref_separator.rs Remove mir::LocalDecl::internal. 2023-10-04 17:55:15 +00:00
dest_prop.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
dump_mir.rs Write to stdout if - is given as output file 2023-06-06 17:53:29 -04:00
early_otherwise_branch.rs add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
elaborate_box_derefs.rs Remove mir::LocalDecl::internal. 2023-10-04 17:55:15 +00:00
elaborate_drops.rs Typo. 2023-10-21 12:14:17 +00:00
errors.rs Do not construct def_path_str for MustNotSuspend. 2023-09-23 13:14:57 +00:00
ffi_unwind_calls.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
function_item_references.rs inline format!() args from rustc_codegen_llvm to the end (4) 2023-07-25 23:20:28 +02:00
gvn.rs Update based on wesleywiser review 2023-10-31 23:41:40 +00:00
inline.rs explain why we don't inline when target features differ 2023-10-28 16:50:40 +02:00
instsimplify.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
jump_threading.rs Expand comment on disappearing edge. 2023-10-21 07:08:53 +00:00
large_enums.rs add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
lib.rs Reorder passes. 2023-10-31 11:44:23 +00:00
lower_intrinsics.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
lower_slice_len.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
match_branches.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
multiple_return_terminators.rs Remove unused TyCtxt from remove_dead_blocks 2023-10-18 23:42:45 +11:00
normalize_array_len.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
nrvo.rs add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
pass_manager.rs Only check in a single place if a pass is enabled. 2023-10-18 16:59:23 +00:00
prettify.rs make reorder BB pass use cached RPO 2023-06-14 20:08:04 +00:00
ref_prop.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
remove_noop_landing_pads.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
remove_place_mention.rs Actually keep PlaceMention if requested. 2023-04-21 21:34:59 +00:00
remove_storage_markers.rs Make MIR basic blocks field public 2022-07-07 08:11:49 +02:00
remove_uninit_drops.rs Do not create move paths that do not need dropping. 2023-10-21 10:32:59 +00:00
remove_unneeded_drops.rs inline format!() args from rustc_codegen_llvm to the end (4) 2023-07-25 23:20:28 +02:00
remove_zsts.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
required_consts.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
reveal_all.rs move subtyper change reveal_all 2023-10-05 18:56:30 +03:00
separate_const_switch.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
shim.rs Some more coroutine renamings 2023-10-30 23:46:27 +00:00
simplify.rs Do not remove unused definitions inside GVN. 2023-10-25 06:46:45 +00:00
simplify_branches.rs Simplify assume of a constant. 2023-10-31 11:44:23 +00:00
simplify_comparison_integral.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
sroa.rs Make the randomize feature of rustc_abi additive 2023-11-05 21:51:47 +03:30
ssa.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
uninhabited_enum_branching.rs Refactor UninhabitedEnumBranching to mark targets unreachable. 2023-10-31 11:44:23 +00:00
unreachable_prop.rs Only emit != assumptions if the otherwise target is reachable. 2023-10-31 11:44:23 +00:00