rust/tests/mir-opt/pre-codegen
bors f8463896a9 Auto merge of #150681 - meithecatte:always-discriminate, r=JonathanBrouwer,Nadrieril
Make operational semantics of pattern matching independent of crate and module

The question of "when does matching an enum against a pattern of one of its variants read its discriminant" is currently an underspecified part of the language, causing weird behavior around borrowck, drop order, and UB.

Of course, in the common cases, the discriminant must be read to distinguish the variant of the enum, but currently the following exceptions are implemented:

1. If the enum has only one variant, we currently skip the discriminant read.
     - This has the advantage that single-variant enums behave the same way as structs in this regard.
     - However, it means that if the discriminant exists in the layout, we can't say that this discriminant being invalid is UB. This makes me particularly uneasy in its interactions with niches – consider the following example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5904a6155cbdd39af4a2e7b1d32a9b1a)), where miri currently doesn't detect any UB (because the semantics don't specify any):

        <details><summary>Example 1</summary>

        ```rust
        #![allow(dead_code)]
        use core::mem::{size_of, transmute};
        
        #[repr(u8)]
        enum Inner {
            X(u8),
        }
        
        enum Outer {
            A(Inner),
            B(u8),
        }
        
        fn f(x: &Inner) {
            match x {
                Inner::X(v) => {
                    println!("{v}");
                }
            }
        }
        
        fn main() {
            assert_eq!(size_of::<Inner>(), 2);
            assert_eq!(size_of::<Outer>(), 2);
            let x = Outer::B(42);
            let y = &x;
            f(unsafe { transmute(y) });
        }
        ```

      </details>

2. For the purpose of the above, enums with marked with `#[non_exhaustive]` are always considered to have multiple variants when observed from foreign crates, but the actual number of variants is considered in the current crate.
    - This means that whether code has UB can depend on which crate it is in: https://github.com/rust-lang/rust/issues/147722
    - In another case of `#[non_exhaustive]` affecting the runtime semantics, its presence or absence can change what gets captured by a closure, and by extension, the drop order: https://github.com/rust-lang/rust/issues/147722#issuecomment-3674554872
    - Also at the above link, there is an example where removing `#[non_exhaustive]` can cause borrowck to suddenly start failing in another crate.
3. Moreover, we currently make a more specific check: we only read the discriminant if there is more than one *inhabited* variant in the enum.
    - This means that the semantics can differ between `foo<!>`, and a copy of `foo` where `T` was manually replaced with `!`: rust-lang/rust#146803
    - Moreover, due to the privacy rules for inhabitedness, it means that the semantics of code can depend on the *module* in which it is located.
    - Additionally, this inhabitedness rule is even uglier due to the fact that closure capture analysis needs to happen before we can determine whether types are uninhabited, which means that whether the discriminant read happens has a different answer specifically for capture analysis.
    - For the two above points, see the following example ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=a07d8a3ec0b31953942e96e2130476d9)):

        <details><summary>Example 2</summary>

        ```rust
        #![allow(unused)]
        
        mod foo {
            enum Never {}
            struct PrivatelyUninhabited(Never);
            pub enum A {
                V(String, String),
                Y(PrivatelyUninhabited),
            }
            
            fn works(mut x: A) {
                let a = match x {
                    A::V(ref mut a, _) => a,
                    _ => unreachable!(),
                };
                
                let b = match x {
                    A::V(_, ref mut b) => b,
                    _ => unreachable!(),
                };
            
                a.len(); b.len();
            }
            
            fn fails(mut x: A) {
                let mut f = || match x {
                    A::V(ref mut a, _) => (),
                    _ => unreachable!(),
                };
                
                let mut g = || match x {
                    A::V(_, ref mut b) => (),
                    _ => unreachable!(),
                };
            
                f(); g();
            }
        }
        
        use foo::A;
        
        fn fails(mut x: A) {
            let a = match x {
                A::V(ref mut a, _) => a,
                _ => unreachable!(),
            };
            
            let b = match x {
                A::V(_, ref mut b) => b,
                _ => unreachable!(),
            };
        
            a.len(); b.len();
        }
        
        
        fn fails2(mut x: A) {
            let mut f = || match x {
                A::V(ref mut a, _) => (),
                _ => unreachable!(),
            };
            
            let mut g = || match x {
                A::V(_, ref mut b) => (),
                _ => unreachable!(),
            };
        
            f(); g();
        }
        ```

        </details>

In light of the above, and following the discussion at rust-lang/rust#138961 and rust-lang/rust#147722, this PR ~~makes it so that, operationally, matching on an enum *always* reads its discriminant.~~ introduces the following changes to this behavior:

 - matching on a `#[non_exhaustive]` enum will always introduce a discriminant read, regardless of whether the enum is from an external crate
 - uninhabited variants now count just like normal ones, and don't get skipped in the checks

As per the discussion below, the resolution for point (1) above is that it should land as part of a separate PR, so that the subtler decision can be more carefully considered.

Note that this is a breaking change, due to the aforementioned changes in borrow checking behavior, new UB (or at least UB newly detected by miri), as well as drop order around closure captures. However, it seems to me that the combination of this PR with rust-lang/rust#138961 should have smaller real-world impact than rust-lang/rust#138961 by itself.

Fixes rust-lang/rust#142394 
Fixes rust-lang/rust#146590
Fixes rust-lang/rust#146803 (though already marked as duplicate)
Fixes parts of rust-lang/rust#147722
Fixes rust-lang/miri#4778

r? @Nadrieril @RalfJung 

@rustbot label +A-closures +A-patterns +T-opsem +T-lang
2026-02-14 12:53:09 +00:00
..
chained_comparison.bitand.PreCodegen.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
chained_comparison.naive.PreCodegen.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
chained_comparison.returning.PreCodegen.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
chained_comparison.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
checked_ops.checked_shl.PreCodegen.after.panic-abort.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
checked_ops.rs Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
checked_ops.saturating_sub_at_home.PreCodegen.after.panic-abort.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
checked_ops.saturating_sub_at_home.PreCodegen.after.panic-unwind.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
checked_ops.step_forward.PreCodegen.after.panic-abort.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
checked_ops.step_forward.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
checked_ops.use_checked_sub.PreCodegen.after.panic-abort.mir Add MIR pre-codegen tests to track 138544 2025-03-15 14:13:37 -07:00
checked_ops.use_checked_sub.PreCodegen.after.panic-unwind.mir Add MIR pre-codegen tests to track 138544 2025-03-15 14:13:37 -07:00
clone_as_copy.clone_as_copy.PreCodegen.after.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
clone_as_copy.rs mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
const_promotion_option_ordering_eq.direct.PreCodegen.after.mir Adding a regression test (const promotion with Option<Ordering>) 2025-10-10 12:23:45 +00:00
const_promotion_option_ordering_eq.rs Adding a regression test (const promotion with Option<Ordering>) 2025-10-10 12:23:45 +00:00
const_promotion_option_ordering_eq.with_let.PreCodegen.after.mir Adding a regression test (const promotion with Option<Ordering>) 2025-10-10 12:23:45 +00:00
dead_on_invalid_place.invalid_place.PreCodegen.after.mir mir-opt: Eliminate dead statements even if they are used by debuginfos 2025-10-02 14:58:59 +08:00
dead_on_invalid_place.rs mir-opt: Eliminate dead statements even if they are used by debuginfos 2025-10-02 14:58:59 +08:00
deref_nested_borrows.rs GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
deref_nested_borrows.src.GVN.panic-abort.diff GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
deref_nested_borrows.src.GVN.panic-unwind.diff GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
deref_nested_borrows.src.PreCodegen.after.panic-abort.mir GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
deref_nested_borrows.src.PreCodegen.after.panic-unwind.mir GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
derived_ord.demo_le.PreCodegen.after.mir Maintain a graph of fulfilled conditions. 2025-11-16 01:38:16 +00:00
derived_ord.rs Maintain a graph of fulfilled conditions. 2025-11-16 01:38:16 +00:00
derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
derived_ord_debug.rs Add a mir-opt test for *debug* MIR from derive(PartialOrd, Ord) 2025-08-03 17:30:40 -07:00
derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir Add a mir-opt test for *debug* MIR from derive(PartialOrd, Ord) 2025-08-03 17:30:40 -07:00
derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir Add a mir-opt test for *debug* MIR from derive(PartialOrd, Ord) 2025-08-03 17:30:40 -07:00
derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir Add a mir-opt test for *debug* MIR from derive(PartialOrd, Ord) 2025-08-03 17:30:40 -07:00
derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir Add a mir-opt test for *debug* MIR from derive(PartialOrd, Ord) 2025-08-03 17:30:40 -07:00
drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
drop_boxed_slice.rs Update ptr::Alignment to go through transmuting 2026-01-25 17:19:28 -08:00
duplicate_switch_targets.rs Enable more mir-opt tests in debug builds 2024-03-22 20:14:39 -04:00
duplicate_switch_targets.ub_if_b.PreCodegen.after.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
intrinsics.f_u64.PreCodegen.after.mir At debuginfo=0, don't inline debuginfo when inlining 2024-04-18 09:35:35 -07:00
intrinsics.f_unit.PreCodegen.after.mir At debuginfo=0, don't inline debuginfo when inlining 2024-04-18 09:35:35 -07:00
intrinsics.rs rustfmt tests/mir-opt. 2024-06-03 14:17:16 +10:00
issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff Adjust Alignment to emphasize that we don't look at its field 2026-01-25 17:24:45 -08:00
issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff Adjust Alignment to emphasize that we don't look at its field 2026-01-25 17:24:45 -08:00
issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff Adjust Alignment to emphasize that we don't look at its field 2026-01-25 17:24:45 -08:00
issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff Adjust Alignment to emphasize that we don't look at its field 2026-01-25 17:24:45 -08:00
issue_117368_print_invalid_constant.rs ignore/fix layout-sensitive tests 2024-08-31 23:56:45 +02:00
loops.filter_mapped.PreCodegen.after.mir mir-opt: Eliminate dead ref statements 2025-10-02 14:55:50 +08:00
loops.int_range.PreCodegen.after.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
loops.mapped.PreCodegen.after.mir mir-opt: Eliminate dead ref statements 2025-10-02 14:55:50 +08:00
loops.rs mir-opt: Eliminate dead ref statements 2025-10-02 14:55:50 +08:00
loops.vec_move.PreCodegen.after.mir Ignore #[doc(hidden)] items when computing trimmed paths 2026-01-19 12:27:27 +11:00
matchbr.match1.PreCodegen.after.mir mir-opt: execute MatchBranchSimplification after GVN 2025-04-21 21:46:44 +08:00
matchbr.rs mir-opt: execute MatchBranchSimplification after GVN 2025-04-21 21:46:44 +08:00
matches_macro.issue_77355_opt.PreCodegen.after.mir Update mir-opt expected output for matches! macro 2025-07-25 22:34:55 +02:00
matches_macro.rs Remove ConstGoto and SeparateConstSwitch. 2024-02-09 21:13:53 +00:00
mem_replace.manual_replace.PreCodegen.after.panic-abort.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
mem_replace.mem_replace.PreCodegen.after.panic-abort.mir Allow more top-down inlining for single-BB callees 2025-03-12 22:39:43 -07:00
mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir Allow more top-down inlining for single-BB callees 2025-03-12 22:39:43 -07:00
mem_replace.rs tests: ignore-debug -> ignore-std-debug-assertions 2024-10-31 17:33:42 +08:00
no_inlined_clone.rs Perform instsimplify before inline to eliminate some trivial calls 2024-07-29 18:14:35 +08:00
no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir Remove unsound-mir-opts for simplify_aggregate_to_copy 2025-04-03 21:59:43 +08:00
optimizes_into_variable.main.GVN.32bit.panic-abort.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.GVN.32bit.panic-unwind.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.GVN.64bit.panic-abort.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.GVN.64bit.panic-unwind.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
optimizes_into_variable.rs Use -Zdump-mir-exclude-alloc-bytes in some mir-opt tests 2024-06-26 15:05:01 -07:00
option_bubble_debug.option_direct.PreCodegen.after.panic-abort.mir Add a debug-mode MIR pre-codegen test for ?-on-Option 2025-08-03 17:30:40 -07:00
option_bubble_debug.option_direct.PreCodegen.after.panic-unwind.mir Add a debug-mode MIR pre-codegen test for ?-on-Option 2025-08-03 17:30:40 -07:00
option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir Move into_try_type to a free function 2025-11-13 19:53:02 -08:00
option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir Move into_try_type to a free function 2025-11-13 19:53:02 -08:00
option_bubble_debug.rs Add a debug-mode MIR pre-codegen test for ?-on-Option 2025-08-03 17:30:40 -07:00
ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-abort.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-unwind.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-abort.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-unwind.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
ptr_offset.rs tests: ignore-debug -> ignore-std-debug-assertions 2024-10-31 17:33:42 +08:00
range_iter.forward_loop.PreCodegen.after.panic-abort.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
range_iter.forward_loop.PreCodegen.after.panic-unwind.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir std::range 2025-01-30 20:37:56 -07:00
range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir std::range 2025-01-30 20:37:56 -07:00
range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir std::range 2025-01-30 20:37:56 -07:00
range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir std::range 2025-01-30 20:37:56 -07:00
range_iter.range_iter_next.PreCodegen.after.panic-abort.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
range_iter.rs Remove some only- clauses from mir-opt tests 2024-03-18 10:07:43 -04:00
README.md Update SUMMARY.md 2025-07-14 12:01:41 +03:00
simple_option_map.ezmap.PreCodegen.after.mir Add MIR pre-codegen tests to track 138544 2025-03-15 14:13:37 -07:00
simple_option_map.map_via_question_mark.PreCodegen.after.mir discriminant reads: make semantics independent of module/crate 2026-01-15 19:12:13 +01:00
simple_option_map.rs Add MIR pre-codegen tests to track 138544 2025-03-15 14:13:37 -07:00
slice_filter.rs Ignore less tests in debug builds 2024-02-23 18:04:01 -05:00
slice_filter.variant_a-{closure#0}.PreCodegen.after.mir GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
slice_filter.variant_b-{closure#0}.PreCodegen.after.mir GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
slice_index.rs Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir Convert moves of references to copies in RefProp 2025-08-11 23:10:56 -04:00
slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir Convert moves of references to copies in RefProp 2025-08-11 23:10:56 -04:00
slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_index.slice_index_range.PreCodegen.after.panic-abort.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung" 2025-01-27 23:42:47 +00:00
slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir WF check lifetime bounds for locals with type params 2026-02-13 00:33:47 +09:00
slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir Maintain a graph of fulfilled conditions. 2025-11-16 01:38:16 +00:00
slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
slice_iter.forward_loop.PreCodegen.after.panic-abort.mir Maintain a graph of fulfilled conditions. 2025-11-16 01:38:16 +00:00
slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir Maintain a graph of fulfilled conditions. 2025-11-16 01:38:16 +00:00
slice_iter.range_loop.PreCodegen.after.panic-abort.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
slice_iter.range_loop.PreCodegen.after.panic-unwind.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.rs tests: ignore-debug -> ignore-std-debug-assertions 2024-10-31 17:33:42 +08:00
slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
spans.outer.PreCodegen.after.panic-abort.mir mir-opt: Eliminate dead ref statements 2025-10-02 14:55:50 +08:00
spans.outer.PreCodegen.after.panic-unwind.mir mir-opt: Eliminate dead ref statements 2025-10-02 14:55:50 +08:00
spans.rs At debuginfo=0, don't inline debuginfo when inlining 2024-04-18 09:35:35 -07:00
try_identity.new.PreCodegen.after.mir Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
try_identity.old.PreCodegen.after.mir Remove unsound-mir-opts for simplify_aggregate_to_copy 2025-04-03 21:59:43 +08:00
try_identity.rs rustfmt tests/mir-opt. 2024-06-03 14:17:16 +10:00
tuple_ord.demo_ge_partial.PreCodegen.after.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
tuple_ord.demo_le_total.PreCodegen.after.mir Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
tuple_ord.rs Add chaining versions of lt/le/gt/ge and use them in tuple PartialOrd 2025-03-19 09:27:02 -07:00
two_unwrap_unchecked.rs GVN: Preserve derefs at terminators that cannot write to memory 2025-10-16 23:03:05 +08:00
two_unwrap_unchecked.two_unwrap_unchecked.GVN.diff GVN: Preserve derefs at terminators that cannot write to memory 2025-10-16 23:03:05 +08:00
two_unwrap_unchecked.two_unwrap_unchecked.PreCodegen.after.mir GVN: Preserve derefs at terminators that cannot write to memory 2025-10-16 23:03:05 +08:00
vec_deref.rs Add a MIR pre-codegen test for Vec::deref 2024-04-21 11:08:36 -07:00
vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir Ignore #[doc(hidden)] items when computing trimmed paths 2026-01-19 12:27:27 +11:00
vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir Ignore #[doc(hidden)] items when computing trimmed paths 2026-01-19 12:27:27 +11:00

The goal of this directory is to track the quality of MIR that is given to codegen in a standard -O configuration.

As such, feel free to --bless whatever changes you get here, so long as doing so doesn't add substantially more MIR.