rust/tests/mir-opt/building
Stuart Cook 4529dd9192
Rollup merge of #143028 - dianne:let-else-storage, r=oli-obk,traviscross
emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching

This PR removes special handling of `let`-`else`, so that `StorageLive`s are emitted and `StorageDead`s are scheduled only after pattern-matching has succeeded. This means `StorageDead`s will no longer appear for all of its bindings on the `else` branch (because they're not live yet) and its drops&`StorageDead`s will happen together like they do elsewhere, rather than having all drops first, then all `StorageDead`s.

This fixes rust-lang/rust#142056, and is therefore a breaking change. I believe it'll need a crater run and a T-lang nomination/fcp thereafter. Specifically, this makes drop-checking slightly more restrictive for `let`-`else` to match the behavior of other variable binding forms. An alternative approach could be to change the relative order of drops and `StorageDead`s for other binding forms to make drop-checking more permissive, but making that consistent would be a significantly more involved change.

r? mir
cc `````@dingxiangfei2009`````

`````@rustbot````` label +T-lang +needs-crater
2025-08-07 20:49:38 +10:00
..
custom Dont print arg span in MIR dump for tail call 2025-08-04 18:35:43 +00:00
match Do not optimize out SwitchInt before borrowck, or if Zmir-preserve-ub 2025-04-08 21:05:20 +00:00
async_await.a-{closure#0}.coroutine_resume.0.mir In pretty_print_type(), print async fn futures' paths instead of spans. 2024-03-25 08:01:15 -07:00
async_await.b-{closure#0}.coroutine_resume.0.mir Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
async_await.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dump_mir_cycle.rs Fix cycle error only occurring with -Zdump-mir 2025-01-10 08:57:54 +00:00
enum_cast.bar.built.after.mir MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.boo.built.after.mir MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.far.built.after.mir MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.foo.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
enum_cast.offsetty.built.after.mir MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.rs MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.signy.built.after.mir MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
enum_cast.unsigny.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
eq_never_type._f.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
eq_never_type.rs Add a test for a == b where a: !, b: ! 2024-04-19 11:05:02 +00:00
index_array_and_slice.index_array.built.after.mir Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
index_array_and_slice.index_const_generic_array.built.after.mir Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
index_array_and_slice.index_custom.built.after.mir Represent the raw pointer for a array length check as a new kind of fake borrow 2025-01-28 00:00:33 +00:00
index_array_and_slice.index_mut_slice.built.after.mir Represent the raw pointer for a array length check as a new kind of fake borrow 2025-01-28 00:00:33 +00:00
index_array_and_slice.index_slice.built.after.mir Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
index_array_and_slice.rs Represent the raw pointer for a array length check as a new kind of fake borrow 2025-01-28 00:00:33 +00:00
issue_49232.main.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
issue_49232.rs Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
issue_101867.main.built.after.mir Rollup merge of #143028 - dianne:let-else-storage, r=oli-obk,traviscross 2025-08-07 20:49:38 +10:00
issue_101867.rs Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
issue_110508.rs Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
issue_110508.{impl#0}-BAR.built.after.mir Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
issue_110508.{impl#0}-SELF_BAR.built.after.mir Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
logical_or_in_conditional.rs Remove let_chains feature gate from even more tests 2025-04-18 15:57:29 +02:00
logical_or_in_conditional.test_complex.built.after.mir Remove let_chains feature gate from even more tests 2025-04-18 15:57:29 +02:00
logical_or_in_conditional.test_or.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
receiver_ptr_mutability.main.built.after.mir yeet CanonicalVarInfo 2025-05-23 12:10:53 +00:00
receiver_ptr_mutability.rs Arbitrary self types v2: pointers feature gate. 2024-08-27 17:32:35 +00:00
shifts.rs rustfmt tests/mir-opt. 2024-06-03 14:17:16 +10:00
shifts.shift_signed.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
shifts.shift_unsigned.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
storage_live_dead_in_statics.rs rustfmt tests/mir-opt. 2024-06-03 14:17:16 +10:00
storage_live_dead_in_statics.XXX.built.after.mir Give an AllocId to ConstValue::Slice. 2025-07-23 23:54:37 +00:00
uniform_array_move_out.move_out_by_subslice.built.after.mir Return the otherwise_block instead of passing it as argument 2024-07-09 22:47:35 +02:00
uniform_array_move_out.move_out_from_end.built.after.mir Return the otherwise_block instead of passing it as argument 2024-07-09 22:47:35 +02:00
uniform_array_move_out.rs turn rustc_box into an intrinsic 2025-01-03 12:01:31 +01:00
user_type_annotations.let_else.built.after.mir Rollup merge of #143028 - dianne:let-else-storage, r=oli-obk,traviscross 2025-08-07 20:49:38 +10:00
user_type_annotations.let_else_bindless.built.after.mir Give an AllocId to ConstValue::Slice. 2025-07-23 23:54:37 +00:00
user_type_annotations.let_init.built.after.mir Add a mir-opt test that demonstrates user type annotations 2025-03-16 12:10:35 +11:00
user_type_annotations.let_init_bindless.built.after.mir Add a mir-opt test that demonstrates user type annotations 2025-03-16 12:10:35 +11:00
user_type_annotations.let_uninit.built.after.mir Split visit_primary_bindings into two variants 2025-03-16 12:10:35 +11:00
user_type_annotations.let_uninit_bindless.built.after.mir Split visit_primary_bindings into two variants 2025-03-16 12:10:35 +11:00
user_type_annotations.match_assoc_const.built.after.mir Add a mir-opt test that demonstrates user type annotations 2025-03-16 12:10:35 +11:00
user_type_annotations.match_assoc_const_range.built.after.mir Add a mir-opt test that demonstrates user type annotations 2025-03-16 12:10:35 +11:00
user_type_annotations.rs Add a mir-opt test that demonstrates user type annotations 2025-03-16 12:10:35 +11:00
while_storage.rs Update mir-opt filechecks 2024-08-18 15:52:23 -07:00
while_storage.while_loop.PreCodegen.after.panic-abort.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
while_storage.while_loop.PreCodegen.after.panic-unwind.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00