rust/tests/ui/pattern
Matthias Krüger 193a28d9b4
Rollup merge of #144006 - dianne:match-ergonomics-jargon, r=Nadrieril
clarify wording of match ergonomics diagnostics (`rust_2024_incompatible_pat` lint and error)

Partially addresses rust-lang/rust#143557:
- Uses different wording than the Edition Guide chapter, to hopefully stand alone a bit better. Instead of referring to the "default binding mode", it now talks about what can't be written "within elided reference patterns". I ended up going with "elided" instead of "implicit" in hope that it reads bit less like it should behave the same as an explicit reference pattern, but I'm not totally happy with that wording.
- The explanatory note still points to where the default binding mode was introduced, but only refers to its effect, not what we call it. How that relates to the rest of the diagnostic may still be a bit of a puzzle, but hopefully it isn't too much of one? It also doesn't make sense anymore for the case of `&` written under a by-ref binding mode, so I've left the note out in that case (but kept the label). It's more cramped, but talking about binding modes would feel like a non-sequitur for the error about `&` patterns without further explanation.
- Links to the stable version of the Edition Guide instead of the nightly version. It looks like almost every link to the Edition Guide in diagnostics is to the nightly version, presumably for the same reason as here: the diagnostics were added before the new Edition was stabilized, then never updated. I'll make a separate PR to clean up the others.

This only changes the diagnostic messages, not the code suggestion or the Edition Guide.

r? `@Nadrieril` or reassign
2025-10-08 15:39:25 +02:00
..
auxiliary Move some tests out of tests/ui 2025-05-03 17:22:52 +02:00
bindings-after-at lower bindings in the order they're written 2025-08-06 12:13:40 -07:00
deref-patterns fix: Add col separator before secondary messages with no source 2025-08-26 15:15:17 -06:00
move-ref-patterns Mention type that could be Clone but isn't in more cases 2025-07-25 18:34:10 +00:00
rfc-3627-match-ergonomics-2024 clarify wording of match ergonomics diagnostics 2025-10-08 02:12:24 -07:00
rfc-3637-guard-patterns On binding not present in all patterns, suggest potential typo 2025-08-25 15:16:25 +00:00
usefulness test: Subtract code_offset from width for ui_testing 2025-10-02 05:45:16 -06:00
array-length-mismatch-13482.rs comments 2025-08-05 19:34:46 +05:00
array-length-mismatch-13482.stderr comments 2025-08-05 19:34:46 +05:00
array-length-mismatch-verbose-13482.rs comments 2025-08-05 19:34:46 +05:00
array-length-mismatch-verbose-13482.stderr comments 2025-08-05 19:34:46 +05:00
at-in-struct-patterns.rs don't uppercase error messages 2025-09-03 15:24:49 +02:00
at-in-struct-patterns.stderr don't uppercase error messages 2025-09-03 15:24:49 +02:00
box-pattern-constructor-mismatch.rs always check for mixed deref pattern and normal constructors 2025-07-04 23:47:31 -07:00
box-pattern-constructor-mismatch.stderr always check for mixed deref pattern and normal constructors 2025-07-04 23:47:31 -07:00
box-pattern-type-mismatch.rs Replace some Option<Diag> with Result<(), Diag> 2024-06-13 06:16:12 +00:00
box-pattern-type-mismatch.stderr Replace some Option<Diag> with Result<(), Diag> 2024-06-13 06:16:12 +00:00
by-move-pattern-binding.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
by-move-pattern-binding.stderr Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
byte-string-inference.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
byte-string-mutability-mismatch.rs compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
byte-string-mutability-mismatch.stderr compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
check-struct-pat-fields-stability-issue-138319.rs Pass precise HirId when calling check_stability 2025-03-14 14:51:58 +08:00
check-struct-pat-fields-stability-issue-138319.stderr Pass precise HirId when calling check_stability 2025-03-14 14:51:58 +08:00
complexity_limit.rs Rename pattern_complexity attr as pattern_complexity_limit. 2025-02-17 09:30:40 +11:00
complexity_limit.stderr Add and update tests to use pattern_complexity 2024-03-03 13:10:15 +01:00
cross-crate-enum-pattern.rs Move some tests out of tests/ui 2025-05-03 17:22:52 +02:00
enum-struct-pattern-mismatch-15896.rs comments 2025-08-09 16:27:20 +05:00
enum-struct-pattern-mismatch-15896.stderr comments 2025-08-09 16:27:20 +05:00
fn-in-pat.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
fn-in-pat.stderr Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
for-loop-bad-item.rs
for-loop-bad-item.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
ignore-all-the-things.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inc-range-pat.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
incorrect-placement-of-pattern-modifiers.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
incorrect-placement-of-pattern-modifiers.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
incorrect-placement-of-pattern-modifiers.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
integer-range-binding.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-6449.rs Use non-2015 edition paths in tests that do not test for their resolution 2025-06-03 13:35:31 +02:00
issue-8351-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-8351-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-10392.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-11577.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-12582.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-14221.rs Use non-2015 edition paths in tests that do not test for their resolution 2025-06-03 13:35:31 +02:00
issue-14221.stderr Reword the "unreachable pattern" explanations 2024-08-19 21:39:57 +02:00
issue-15080.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-17718-patterns.rs
issue-17718-patterns.stderr
issue-22546.rs Check assoc consts and tys later like assoc fns 2025-07-10 23:39:54 +08:00
issue-27320.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-28992-empty.rs Move some tests 2024-02-09 15:43:08 -03:00
issue-28992-empty.stderr Move some tests 2024-02-09 15:43:08 -03:00
issue-52240.rs
issue-52240.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-66270-pat-struct-parser-recovery.rs
issue-66270-pat-struct-parser-recovery.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-67037-pat-tup-scrut-ty-diff-less-fields.rs
issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
issue-67776-match-same-name-enum-variant-refs.rs Change bindings_with_variant_name to deny-by-default 2023-01-20 02:26:12 -05:00
issue-67776-match-same-name-enum-variant-refs.stderr Change bindings_with_variant_name to deny-by-default 2023-01-20 02:26:12 -05:00
issue-72565.rs Avoid emitting the non_exhaustive error if other errors already occurred 2023-10-11 12:49:57 +00:00
issue-72565.stderr Specify type kind of constant that can't be used in patterns 2024-12-04 20:29:36 +00:00
issue-72574-1.rs
issue-72574-1.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-72574-2.rs
issue-72574-2.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-74539.rs
issue-74539.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-74702.rs
issue-74702.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-74954.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-80186-mut-binding-help-suggestion.rs
issue-80186-mut-binding-help-suggestion.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-88074-pat-range-type-inference-err.rs
issue-88074-pat-range-type-inference-err.stderr
issue-88074-pat-range-type-inference.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-92074-macro-ice.rs
issue-92074-macro-ice.stderr Change wording 2024-04-29 14:53:38 +02:00
issue-94866.rs Move tests 2023-05-24 19:35:59 -03:00
issue-94866.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-95878.rs
issue-95878.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-106552.rs suggest fix for attempted integer identifier in patterns 2023-01-14 12:51:20 +13:00
issue-106552.stderr Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
issue-106862.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-106862.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-106862.stderr error-msg: impl better suggestion for E0532 2023-03-15 22:19:54 +13:00
issue-110508.rs Handle all PatExprs in dead code analysis 2025-01-29 15:45:13 +00:00
issue-115599.rs Add additional context for non-sructural type constant used in pattern 2024-12-04 20:29:36 +00:00
issue-115599.stderr fix: Add col separator before secondary messages with no source 2025-08-26 15:15:17 -06:00
issue-117626.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
missing_lifetime.rs Use non-2015 edition paths in tests that do not test for their resolution 2025-06-03 13:35:31 +02:00
missing_lifetime.stderr Avoid follow-up errors on erroneous patterns 2024-06-13 06:14:32 +00:00
mut-ref-mut-2021.rs Feature gate 2024-03-27 11:20:28 -04:00
mut-ref-mut-2021.stderr Better span for "make binding mutable" suggestion 2024-07-04 02:02:21 +00:00
mut_preserve_binding_mode_2021.rs Gate implicit mutable by-reference bindings behind mut ref 2024-05-15 16:55:54 -04:00
mut_preserve_binding_mode_2021.stderr Fix tests 2024-04-15 23:27:22 -04:00
mut_preserve_binding_mode_2024.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
no-match-tuple-variant-self-ctor.rs Validate that we're only matching on unit struct for path pattern 2024-03-22 20:53:42 -04:00
no-match-tuple-variant-self-ctor.struct_.stderr Validate that we're only matching on unit struct for path pattern 2024-03-22 20:53:42 -04:00
no-match-tuple-variant-self-ctor.tuple.stderr Validate that we're only matching on unit struct for path pattern 2024-03-22 20:53:42 -04:00
no-patterns-in-args-2.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
no-patterns-in-args-2.stderr Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
no-patterns-in-args.rs Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
no-patterns-in-args.stderr Move 100 entries from tests/ui into subdirs 2024-05-20 19:55:59 -07:00
non-constant-in-const-path.rs
non-constant-in-const-path.stderr Tweak output of some const pattern errors 2024-12-04 20:29:36 +00:00
non-structural-match-types-cycle-err.rs borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
non-structural-match-types-cycle-err.stderr borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
non-structural-match-types.rs borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
non-structural-match-types.stderr borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
normalize-ty-in-range.rs Structurally resolve in check_ref_cast and calc_adjust_mode 2025-05-08 15:00:17 +00:00
overflowing-literals.rs Uniformly handle HIR literals in visitors and lints 2025-02-05 11:28:24 +00:00
overflowing-literals.stderr Uniformly handle HIR literals in visitors and lints 2025-02-05 11:28:24 +00:00
pat-shadow-in-nested-binding.rs
pat-shadow-in-nested-binding.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pat-struct-field-expr-has-type.rs
pat-struct-field-expr-has-type.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pat-tuple-bad-type.rs
pat-tuple-bad-type.stderr
pat-tuple-field-count-cross.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
pat-tuple-field-count-cross.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
pat-tuple-overfield.rs
pat-tuple-overfield.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
pat-tuple-underfield.rs
pat-tuple-underfield.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
pat-type-err-formal-param.rs
pat-type-err-formal-param.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pat-type-err-let-stmt.rs
pat-type-err-let-stmt.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
patkind-litrange-no-expr.rs Rename PatKind::Lit to Expr 2025-01-08 07:34:59 +00:00
patkind-litrange-no-expr.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
patkind-ref-binding-issue-114896.fixed UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
patkind-ref-binding-issue-114896.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
patkind-ref-binding-issue-114896.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
patkind-ref-binding-issue-122415.fixed Fix incorrect mutable suggestion information for binding in ref pattern. 2024-03-19 12:28:23 +08:00
patkind-ref-binding-issue-122415.rs Fix incorrect mutable suggestion information for binding in ref pattern. 2024-03-19 12:28:23 +08:00
patkind-ref-binding-issue-122415.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
pattern-bad-ref-box-order.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
pattern-bad-ref-box-order.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
pattern-bad-ref-box-order.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
pattern-binding-disambiguation.rs Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
pattern-binding-disambiguation.stderr Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
pattern-error-continue.rs compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
pattern-error-continue.stderr compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
pattern-ident-path-generics.rs
pattern-ident-path-generics.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pattern-match-arc-move.rs cleaned up some tests 2025-06-03 07:38:06 +05:00
pattern-match-invalid-variant.rs cleaned up some tests 2025-06-03 07:38:06 +05:00
pattern-match-invalid-variant.stderr cleaned up some tests 2025-06-03 07:38:06 +05:00
pattern-tyvar-2.rs
pattern-tyvar-2.stderr Change E0369 diagnostic give note information for foreign items. 2024-06-25 10:00:30 +08:00
pattern-tyvar.rs
pattern-tyvar.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
patterns-dont-match-nt-statement.rs Don't make pattern nonterminals match statement nonterminals 2024-08-26 18:30:15 -04:00
premature-match-scrutinee-temporary-drop-10683.rs comments 2025-07-25 20:38:54 +05:00
range-pattern-meant-to-be-slice-rest-pattern.rs Stabilize exclusive_range 2024-05-02 19:42:31 -04:00
range-pattern-meant-to-be-slice-rest-pattern.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
refutable-pattern-for-loop-15381.rs comments 2025-08-09 16:27:20 +05:00
refutable-pattern-for-loop-15381.stderr comments 2025-08-09 16:27:20 +05:00
rest-pat-semantic-disallowed.rs
rest-pat-semantic-disallowed.stderr
rest-pat-syntactic.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
rest-pat-syntactic.stderr Bless tests 2024-01-13 12:46:58 -05:00
self-ctor-133272.rs Re-delay a resolve bug 2024-11-21 18:40:36 +08:00
self-ctor-133272.stderr Re-delay a resolve bug 2024-11-21 18:40:36 +08:00
size-and-align.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
skipped-ref-pats-issue-125058.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
skipped-ref-pats-issue-125058.stderr bless tests with new lint messages 2025-08-19 21:27:10 +02:00
slice-array-infer.rs stabilize gai 2025-06-11 15:30:15 +01:00
slice-pattern-recursion-15104.rs comments 2025-08-09 16:27:20 +05:00
slice-pattern-refutable.rs address review 2023-07-17 22:06:32 +00:00
slice-pattern-refutable.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
slice-patterns-ambiguity.rs add tests for refutable patterns 2023-07-17 22:02:09 +00:00
slice-patterns-ambiguity.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
slice-patterns-irrefutable.rs address review 2023-07-28 11:20:11 +00:00
slice-patterns-irrefutable.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
slice-patterns-nested.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
static-binding-shadow-16149.rs comments 2025-08-09 16:27:20 +05:00
static-binding-shadow-16149.stderr comments 2025-08-09 16:27:20 +05:00
struct-field-duplicate-binding-15260.rs comments 2025-08-09 16:27:20 +05:00
struct-field-duplicate-binding-15260.stderr comments 2025-08-09 16:27:20 +05:00
struct-mismatch-destructure-14541.rs comments 2025-08-05 19:34:46 +05:00
struct-mismatch-destructure-14541.stderr comments 2025-08-05 19:34:46 +05:00
struct-parser-recovery-issue-126344.rs report pat no field error no recoverd struct variant 2024-07-11 00:18:47 +08:00
struct-parser-recovery-issue-126344.stderr report pat no field error no recoverd struct variant 2024-07-11 00:18:47 +08:00
struct-pattern-on-non-struct-resolve-error.rs modify test to side-step platform-dependent stderr output 2025-01-08 00:13:43 +00:00
struct-pattern-on-non-struct-resolve-error.stderr modify test to side-step platform-dependent stderr output 2025-01-08 00:13:43 +00:00
struct-pattern-with-missing-fields-resolve-error.rs Add check for missing fields in enum variant pattern 2025-01-08 00:10:16 +00:00
struct-pattern-with-missing-fields-resolve-error.stderr Add check for missing fields in enum variant pattern 2025-01-08 00:10:16 +00:00
struct-wildcard-pattern-14308.rs comments 2025-08-05 19:34:46 +05:00
suggest-adding-appropriate-missing-pattern-excluding-comments.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-adding-appropriate-missing-pattern-excluding-comments.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-adding-appropriate-missing-pattern-excluding-comments.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
tuple-enum-match-15129.rs comments 2025-08-09 16:27:20 +05:00
type_mismatch.rs Avoid follow-up errors on erroneous patterns 2024-06-13 06:14:32 +00:00
type_mismatch.stderr Avoid follow-up errors on erroneous patterns 2024-06-13 06:14:32 +00:00
uninit-trivial.rs Do not optimize out SwitchInt before borrowck, or if Zmir-preserve-ub 2025-04-08 21:05:20 +00:00
uninit-trivial.stderr Do not optimize out SwitchInt before borrowck, or if Zmir-preserve-ub 2025-04-08 21:05:20 +00:00
unit-pattern-matching-in-function-argument-7519.rs Rehome tests/ui/issues/ tests [2/?] 2025-08-02 15:29:16 -04:00
unit-type-struct-pattern-mismatch-16401.rs comments 2025-08-09 16:27:20 +05:00
unit-type-struct-pattern-mismatch-16401.stderr comments 2025-08-09 16:27:20 +05:00
unit-variant-pattern-matching-29383.rs Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
unit-variant-pattern-matching-29383.stderr Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
unused-parameters-const-pattern.rs Add test/comment about const patterns with unused params 2025-05-22 12:52:46 +01:00