rust/tests/ui/closures
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
..
2229_closure_analysis Auto merge of #150681 - meithecatte:always-discriminate, r=JonathanBrouwer,Nadrieril 2026-02-14 12:53:09 +00:00
binder Feed ErrorGuaranteed from late lifetime resolution to RBV 2026-02-13 16:24:39 +00:00
closure-expected-type Remove all dead files inside tests/ui/ 2025-01-27 02:28:04 +01:00
deduce-signature Fix; correct placement of type inference error for method calls 2025-10-07 09:51:16 +01:00
print Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
add_semicolon_non_block_closure.rs Don't suggest adding return type for closures with default return type 2024-08-28 12:54:39 +08:00
add_semicolon_non_block_closure.stderr Don't suggest adding return type for closures with default return type 2024-08-28 12:54:39 +08:00
aliasability-violation-with-closure-21600.rs Rehome tests/ui/issues/ tests [3/?] 2025-08-04 16:43:53 -04:00
aliasability-violation-with-closure-21600.stderr Provide more context on Fn closure modifying binding 2025-11-03 20:26:18 +00:00
at-pattern-weirdness-issue-137553.rs ExprUseVisitor: remove maybe_read_scrutinee 2025-12-17 20:47:47 +01:00
basic-closure-syntax.rs cleaned up some tests 2025-06-30 11:50:19 +05:00
box-generic-closure.rs Relocate 5 tests from tests/ui/issues 2025-11-27 00:39:52 +09:00
box-generic-closure.stderr Relocate 5 tests from tests/ui/issues 2025-11-27 00:39:52 +09:00
boxed-closure-lifetime-13808.rs comments 2025-08-05 19:34:46 +05:00
cannot-call-unsized-via-ptr-2.rs Always register sized obligation for argument 2023-06-15 03:18:21 +00:00
cannot-call-unsized-via-ptr-2.stderr Always register sized obligation for argument 2023-06-15 03:18:21 +00:00
cannot-call-unsized-via-ptr.rs Always register sized obligation for argument 2023-06-15 03:18:21 +00:00
cannot-call-unsized-via-ptr.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
capture-unsized-by-move.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
capture-unsized-by-move.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
capture-unsized-by-ref.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure-arg-borrow-ice-issue-152331.rs diagnostics: fix ICE in closure signature mismatch 2026-02-08 13:32:50 +01:00
closure-arg-borrow-ice-issue-152331.stderr diagnostics: fix ICE in closure signature mismatch 2026-02-08 13:32:50 +01:00
closure-array-break-length.rs Cleaned up some tests 2025-12-23 21:13:24 +09:00
closure-array-break-length.stderr Cleaned up some tests 2025-12-23 21:13:24 +09:00
closure-bounds-cant-promote-superkind-in-struct.rs Continue compilation after check_mod_type_wf errors 2024-02-14 11:00:30 +00:00
closure-bounds-cant-promote-superkind-in-struct.stderr Mention type parameter in more cases and don't suggest ~const bound already there 2024-12-07 21:37:13 +00:00
closure-bounds-static-cant-capture-borrowed.rs Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-bounds-static-cant-capture-borrowed.stderr Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-bounds-subtype.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-bounds-subtype.stderr Mention type parameter in more cases and don't suggest ~const bound already there 2024-12-07 21:37:13 +00:00
closure-capture-after-clone.rs cleaned up some tests 2025-07-01 16:26:57 +05:00
closure-clone-requires-captured-clone.rs Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-clone-requires-captured-clone.stderr Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-expected.rs Pretty print Fn traits in rustc_on_unimplemented 2023-11-02 20:57:05 +00:00
closure-expected.stderr Use parenthetical notation for Fn traits 2024-05-29 22:26:54 +00:00
closure-immut-capture-error.rs cleaned up some tests 2025-06-04 17:48:50 +05:00
closure-immut-capture-error.stderr cleaned up some tests 2025-06-04 17:48:50 +05:00
closure-immutable-outer-variable.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure-immutable-outer-variable.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure-immutable-outer-variable.rs.fixed Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-immutable-outer-variable.stderr More accurate mutability suggestion 2024-07-04 05:36:34 +00:00
closure-last-use-move.rs cleaned up some tests 2025-07-01 16:26:57 +05:00
closure-move-sync.rs update failing ui tests 2023-06-20 19:46:01 -04:00
closure-move-sync.stderr update references to thread implementation in tests 2025-11-29 15:59:11 +01:00
closure-move-use-after-move-diagnostic.rs Tweak help to unify formatting and wording 2026-02-01 18:20:31 +00:00
closure-move-use-after-move-diagnostic.stderr Tweak help to unify formatting and wording 2026-02-01 18:20:31 +00:00
closure-mut-argument-6153.rs Add test batch 1 2025-08-27 00:23:26 -04:00
closure-no-copy-mut-env.rs cleaned up some tests 2025-07-05 01:25:48 +05:00
closure-no-copy-mut-env.stderr cleaned up some tests 2025-07-05 01:25:48 +05:00
closure-no-fn-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-no-fn-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure-no-fn-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-no-fn-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure-no-fn-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-no-fn-3.stderr Note closure captures when reporting deferred cast to fn ptr failed 2024-07-22 21:51:44 -04:00
closure-no-fn-4.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-no-fn-4.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure-no-fn-5.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-no-fn-5.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure-referencing-itself-issue-25954.rs Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-referencing-itself-issue-25954.stderr Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
closure-reform-bad.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-reform-bad.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure-return-type-mismatch.rs Pass correct HirId to late_bound_vars in diagnostic code 2024-09-26 19:26:08 +02:00
closure-return-type-mismatch.stderr Merge typeck loop with static/const item eval loop 2025-05-09 15:31:27 +00:00
closure-return-type-must-be-sized.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-return-type-must-be-sized.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
closure-type-inference-in-context-9129.rs Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
closure-upvar-last-use-analysis.rs cleaned up some tests 2025-07-01 16:26:57 +05:00
closure-upvar-trait-caching.rs Cleaned up some tests 2025-12-16 02:10:08 +09:00
closure-wrong-kind.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure-wrong-kind.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
closure_cap_coerce_many_fail.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
closure_cap_coerce_many_fail.stderr adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
closure_no_cap_coerce_many_check_pass.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure_no_cap_coerce_many_run_pass.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure_no_cap_coerce_many_unsafe_0.rs Remove revisions for THIR unsafeck 2024-01-05 09:30:27 +00:00
closure_no_cap_coerce_many_unsafe_0.stderr Remove revisions for THIR unsafeck 2024-01-05 09:30:27 +00:00
closure_no_cap_coerce_many_unsafe_1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
closure_promotion.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-unsafe-closure-to-unsafe-fn-ptr.rs Remove revisions for THIR unsafeck 2024-01-05 09:30:27 +00:00
coerce-unsafe-closure-to-unsafe-fn-ptr.stderr update ui tests 2024-01-07 08:56:20 -08:00
coerce-unsafe-to-closure.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-unsafe-to-closure.stderr remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
correct-args-on-call-suggestion.rs Fix closure arg extraction in extract_callable_info 2024-11-02 03:42:10 +00:00
correct-args-on-call-suggestion.stderr Fix closure arg extraction in extract_callable_info 2024-11-02 03:42:10 +00:00
deduce-from-object-supertrait.rs Do not deduplicate list of associated types provided by dyn principal 2025-02-21 19:32:45 +00:00
deeply-nested_closures.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
diverging-closure.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
eager-mono-with-normalizable-upvars.rs Normalize closure instance before eagerly monomorphizing it 2025-02-14 19:18:43 +00:00
fnonce-call-twice-error.rs cleaned up some tests 2025-07-05 00:50:51 +05:00
fnonce-call-twice-error.stderr cleaned up some tests 2025-07-05 00:50:51 +05:00
fnonce-moved-twice-12127.rs comments 2025-07-31 21:25:49 +05:00
fnonce-moved-twice-12127.stderr comments 2025-07-31 21:25:49 +05:00
generic-typed-nested-closures-59494.rs Add test batch 3 2025-09-12 14:45:12 -04:00
generic-typed-nested-closures-59494.stderr Add test batch 3 2025-09-12 14:45:12 -04:00
issue-868.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-1460.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-1460.stderr bless tests with new lint messages 2025-08-19 21:27:10 +02:00
issue-5239-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-5239-1.stderr Move some tests 2024-04-21 15:43:43 -03:00
issue-5239-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-6801.rs Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
issue-6801.stderr Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
issue-10398.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-10398.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-10682.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-11873.rs Move tests 2023-08-28 17:47:37 -03:00
issue-11873.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-22864-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-22864-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-25439.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
issue-25439.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-41366.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-42463.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-46742.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-48109.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-52437.rs address review comments 2025-08-22 13:16:44 +08:00
issue-52437.stderr address review comments 2025-08-22 13:16:44 +08:00
issue-67123.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-67123.stderr reword trait bound suggestion message to include the bounds 2024-12-07 21:26:20 +00:00
issue-68025.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-72408-nested-closures-exponential.rs Gate the type length limit check behind a nightly flag 2024-07-12 21:16:09 -04:00
issue-78720.rs re-use sized fast path 2025-04-09 10:42:26 +00:00
issue-78720.stderr Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
issue-80313-mutable-borrow-in-closure.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80313-mutable-borrow-in-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-80313-mutable-borrow-in-move-closure.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80313-mutable-borrow-in-move-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-80313-mutation-in-closure.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80313-mutation-in-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-80313-mutation-in-move-closure.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80313-mutation-in-move-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-81700-mut-borrow.rs Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
issue-81700-mut-borrow.stderr Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
issue-82438-mut-without-upvar.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-82438-mut-without-upvar.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-84044-drop-non-mut.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-84044-drop-non-mut.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-84128.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-84128.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-87461.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-87461.stderr Emit a hint for bad call return types due to generic arguments 2023-01-13 13:34:55 +09:00
issue-87814-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-87814-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-90871.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-90871.stderr Make typo in field and name suggestions verbose 2025-12-09 17:29:23 +00:00
issue-97607.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-99565.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-99565.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-101696.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-102089-multiple-opaque-cast.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-109188.rs Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
issue-109188.stderr Return equal for two identical projections 2023-03-21 15:28:11 +08:00
issue-111932.rs diagnostics: do not suggest type name tweaks on type-inferred closure args 2023-06-05 19:05:15 -07:00
issue-111932.stderr Do not mention -Zmacro-backtrace for std macros that are a wrapper around a compiler intrinsic 2026-01-26 17:34:31 +00:00
issue-113087.rs don't suggest move for borrows that aren't closures 2023-06-28 23:56:58 +02:00
issue-113087.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
labeled-break-inside-closure-62480.rs Add test batch 4 2025-10-11 21:59:51 -04:00
labeled-break-inside-closure-62480.stderr Add test batch 4 2025-10-11 21:59:51 -04:00
local-enums-in-closure-2074.rs rename various regression tests 2026-02-01 04:09:25 +00:00
local-type-mix.rs Stabilize async closures 2024-12-13 00:04:56 +00:00
local-type-mix.stderr Stabilize async closures 2024-12-13 00:04:56 +00:00
malformed-pattern-issue-140011.rs Mark crash 140011 as fixed 2025-12-17 20:47:48 +01:00
malformed-pattern-issue-140011.stderr Re-bless tests 2025-12-17 20:47:49 +01:00
many-closures.rs cleaned up some tests 2025-07-01 15:29:29 +05:00
missing-body.rs Replace ItemCtxt::report_placeholder_type_error match with a call to TyCtxt::def_descr 2025-06-30 20:36:16 +02:00
missing-body.stderr Replace ItemCtxt::report_placeholder_type_error match with a call to TyCtxt::def_descr 2025-06-30 20:36:16 +02:00
moved-upvar-mut-rebind-11958.rs Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
moved-upvar-mut-rebind-11958.stderr Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
multiple-fn-bounds.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
multiple-fn-bounds.stderr Don't suggest replacing closure parameter with type name 2026-01-12 18:07:38 -05:00
nested-closure-call.rs Cleaned up some tests 2025-12-16 02:10:08 +09:00
nested-closure-escape-borrow.rs clean up some tests 2026-01-31 14:01:54 +01:00
nested-closure-escape-borrow.stderr clean up some tests 2026-01-31 14:01:54 +01:00
no-capture-closure-call.rs cleaned up some tests 2025-07-10 18:50:35 +05:00
old-closure-arg-call-as.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-arg.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-explicit-types.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-expr-precedence.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-expr-precedence.stderr bless tests with new lint messages 2025-08-19 21:27:10 +02:00
old-closure-expression-remove-semicolon.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-expression-remove-semicolon.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-expression-remove-semicolon.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
old-closure-fn-coerce.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-iter-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
old-closure-iter-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
once-move-out-on-heap.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
opaque-upvar.rs Be a bit more relaxed about not yet constrained infer vars in closure upvar analysis 2025-05-05 19:06:45 +00:00
or-patterns-issue-137467.rs Move some match edge case tests 2026-01-15 17:22:58 +01:00
return-type-doesnt-match-bound.rs Shorten error message for callable with wrong return type 2025-02-02 01:00:33 +00:00
return-type-doesnt-match-bound.stderr Shorten error message for callable with wrong return type 2025-02-02 01:00:33 +00:00
return-value-lifetime-error.fixed Provide suggestion to dereference closure tail if appropriate 2024-04-05 19:42:55 +00:00
return-value-lifetime-error.rs Provide suggestion to dereference closure tail if appropriate 2024-04-05 19:42:55 +00:00
return-value-lifetime-error.stderr Provide suggestion to dereference closure tail if appropriate 2024-04-05 19:42:55 +00:00
self-supertrait-bounds.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
semistatement-in-lambda.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
simple-capture-and-call.rs Cleaned up some tests 2025-12-08 07:06:13 +09:00
static-closures-with-nonstatic-return.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
supertrait-hint-cycle-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
supertrait-hint-cycle-3.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
supertrait-hint-cycle.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
supertrait-hint-references-assoc-ty.rs "normalize" signature before checking mentions self 2025-01-28 14:11:29 +00:00
thir-unsafeck-issue-85871.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unsized_value_move.rs clean up some tests 2026-01-31 14:01:54 +01:00
unsized_value_move.stderr clean up some tests 2026-01-31 14:01:54 +01:00
unused-closure-ice-16256.rs comments 2025-08-09 16:27:20 +05:00
unused-closure-ice-16256.stderr bless tests with new lint messages 2025-08-19 21:27:10 +02:00
upvar-or-pattern-issue-138958.rs Add a regression test for TestCase::Or without place 2025-03-26 02:25:01 +01:00
wrong-closure-arg-suggestion-125325.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
wrong-closure-arg-suggestion-125325.stderr Provide more context on Fn closure modifying binding 2025-11-03 20:26:18 +00:00