rust/tests/mir-opt/building/custom
bors 3be68033b6 Auto merge of #145513 - beepster4096:erasedereftemps, r=saethlin,cjgillot
Validate CopyForDeref and DerefTemps better and remove them from runtime MIR

(split from my WIP rust-lang/rust#145344)

This PR:
- Removes `Rvalue::CopyForDeref` and `LocalInfo::DerefTemp` from runtime MIR
    - Using a new mir pass `EraseDerefTemps`
    - `CopyForDeref(x)` is turned into `Use(Copy(x))`
    - `DerefTemp` is turned into `Boring`
        - Not sure if this part is actually necessary, it made more sense in rust-lang/rust#145344 with `DerefTemp` storing actual data that I wanted to keep from having to be kept in sync with the rest of the body in runtime MIR
- Checks in validation that `CopyForDeref` and `DerefTemp` are only used together
- Removes special handling for `CopyForDeref` from many places
- Removes `CopyForDeref` from `custom_mir` reverting rust-lang/rust#111587
    - In runtime MIR simple copies can be used instead
    - In post cleanup analysis MIR it was already wrong to use due to the lack of support for creating `DerefTemp` locals
    - Possibly this should be its own PR?
 - Adds an argument to `deref_finder` to avoid creating new `DerefTemp`s and `CopyForDeref` in runtime MIR.
     - Ideally we would just avoid making intermediate derefs instead of fixing it at the end of a pass / during shim building
 - Removes some usages of `deref_finder` that I found out don't actually do anything

r? oli-obk
2025-10-12 02:34:20 +00:00
..
aggregate_exprs.adt.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
aggregate_exprs.array.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
aggregate_exprs.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
aggregate_exprs.tuple.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
arbitrary_let.arbitrary_let.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
arbitrary_let.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
arrays.arrays.built.after.mir Remove Rvalue::Len. 2025-09-16 22:23:19 +00:00
arrays.rs Remove Rvalue::Len. 2025-09-16 22:23:19 +00:00
as_cast.float_to_int.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
as_cast.int_to_int.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
as_cast.int_to_ptr.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
as_cast.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
assume.assume_constant.built.after.mir Add Assume custom MIR. 2024-01-22 23:55:10 +00:00
assume.assume_local.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
assume.assume_place.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
assume.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
composite_return.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
composite_return.tuple.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
consts.consts.built.after.mir Revert "Create const block DefIds in typeck instead of ast lowering" 2024-06-07 08:33:58 +00:00
consts.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
consts.statics.built.after.mir Normalize alloc-id in tests. 2023-10-16 16:29:35 +00:00
debuginfo.constant.built.after.mir Doc comment custom MIR debuginfo. 2024-11-29 12:32:55 +01:00
debuginfo.numbered.built.after.mir Doc comment custom MIR debuginfo. 2024-11-29 12:32:55 +01:00
debuginfo.pointee.built.after.mir Support debuginfo for custom MIR. 2023-09-01 16:16:31 +00:00
debuginfo.rs Doc comment custom MIR debuginfo. 2024-11-29 12:32:55 +01:00
debuginfo.structured.built.after.mir Support debuginfo for custom MIR. 2023-09-01 16:16:31 +00:00
debuginfo.variant.built.after.mir Support debuginfo for custom MIR. 2023-09-01 16:16:31 +00:00
debuginfo.variant_deref.built.after.mir Support debuginfo for custom MIR. 2023-09-01 16:16:31 +00:00
enums.rs Remove StatementKind::Deinit. 2025-10-10 12:57:24 +00:00
enums.set_discr.built.after.mir Remove StatementKind::Deinit. 2025-10-10 12:57:24 +00:00
enums.set_discr_repr.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
enums.switch_bool.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
enums.switch_option.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
enums.switch_option_repr.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
operators.f.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
operators.g.runtime.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
operators.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
projections.rs remove copyforderef from custom_mir 2025-10-10 20:30:19 -07:00
projections.set.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
projections.simple_index.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
projections.tuples.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
projections.unions.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
projections.unwrap.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
projections.unwrap_deref.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
references.immut_ref.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
references.mut_ref.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
references.raw_pointer.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
references.raw_pointer_offset.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
references.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
simple_assign.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
simple_assign.simple.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
simple_assign.simple_ref.built.after.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
terminators.assert_nonzero.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
terminators.direct_call.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
terminators.drop_first.built.after.mir Bless tests 2023-06-23 18:36:25 +01:00
terminators.drop_second.built.after.mir Bless tests 2023-06-23 18:36:25 +01:00
terminators.indirect_call.built.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
terminators.rs custom MIR: add support for tail calls 2024-08-05 18:23:14 +02:00
terminators.tail_call.built.after.mir Dont print arg span in MIR dump for tail call 2025-08-04 18:35:43 +00:00
unwind_action.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
unwind_terminate.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00