summary refs log tree commit diff
path: root/tests/ui/pattern
AgeCommit message (Collapse)AuthorLines
2024-09-23Parser: better error messages for `@` in struct patternsPavel Grigorenko-0/+83
2024-09-13Add a machine-applicable suggestion to "unreachable pattern"Nadrieril-84/+433
2024-09-11Revert warning empty patterns as unreachableNadrieril-427/+57
2024-08-26Don't make pattern nonterminals match statement nonterminalsMichael Goulet-0/+19
2024-08-20Move the "matches no value" note to be a span labelNadrieril-248/+124
2024-08-19Cap the number of patterns pointed to by the lintNadrieril-9/+52
2024-08-19Add a note with a link to explain empty typesNadrieril-17/+148
2024-08-19Reword the "unreachable pattern" explanationsNadrieril-392/+392
2024-08-13Remove a no-longer-true `assert`Nadrieril-95/+132
2024-08-10Test that 0/unknown-length arrays are nonemptyNadrieril-47/+144
2024-08-10Update testsNadrieril-451/+612
2024-08-10Stabilize `min_exhaustive_patterns`Nadrieril-1/+0
2024-08-03Revert "Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-1/+11
This reverts commit 2724aeaaeb127a8073e39461caacbe21a128ce7b, reversing changes made to d929a42a664c026167800801b26d734db925314f.
2024-07-26Peel off explicit (or implicit) deref before suggesting clone on move error ↵Michael Goulet-16/+0
in borrowck
2024-07-24Improve "covered_by_many" errorNadrieril-21/+102
2024-07-24Explain why a given pattern is considered unreachableNadrieril-122/+824
2024-07-21Explain why we require `_` for empty patternsNadrieril-0/+10
2024-07-18avoid creating an Instance only to immediately disassemble it againRalf Jung-41/+0
2024-07-12Make parse error suggestions verbose and fix spansEsteban Küber-6/+32
Go over all structured parser suggestions and make them verbose style. When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-07-11report pat no field error no recoverd struct variantyukang-0/+60
2024-07-04More accurate mutability suggestionEsteban Küber-4/+10
2024-07-04Better span for "make binding mutable" suggestionEsteban Küber-8/+8
2024-06-27Tighten spans for async blocksMichael Goulet-1/+1
2024-06-26Rollup merge of #126925 - surechen:fix_125631, r=compiler-errorsMatthias Krüger-0/+5
Change E0369 to give note informations for foreign items. Change E0369 to give note informations for foreign items. Make it easy for developers to understand why the binop cannot be applied. fixes #125631
2024-06-25Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelixMatthias Krüger-11/+1
Mark assoc tys live only if the corresponding trait is live r? ````@pnkfelix````
2024-06-25Change E0369 diagnostic give note information for foreign items.surechen-0/+5
Make it easy for developers to understand why the binop cannot be applied. fixes #125631
2024-06-23Replace `f16` and `f128` pattern matching stubs with real implementationsTrevor Gross-23/+97
This section of code depends on `rustc_apfloat` rather than our internal types, so this is one potential ICE that we should be able to melt now. This also fixes some missing range and match handling in `rustc_middle`.
2024-06-18Mark assoc tys live only if the trait is livemu001999-11/+1
2024-06-13Replace some `Option<Diag>` with `Result<(), Diag>`Oli Scherer-0/+38
2024-06-13Avoid follow-up errors on erroneous patternsOli Scherer-0/+91
2024-06-06Rollup merge of #125168 - ↵Matthias Krüger-49/+13
Jules-Bertholet:match-ergonomics-2024-align-with-rfc, r=Nadrieril Match ergonomics 2024: align implementation with RFC - Remove eat-two-layers (`ref_pat_everywhere`) - Consolidate `mut_preserve_binding_mode_2024` into `ref_pat_eat_one_layer_2024` - `&mut` no longer peels off `&` - Apply "no `ref mut` behind `&`" rule on all editions with `ref_pat_eat_one_layer_2024` - Require `mut_ref` feature gate for all mutable by-reference bindings r? ``@Nadrieril`` cc https://github.com/rust-lang/rust/issues/123076 ``@rustbot`` label A-edition-2024 A-patterns
2024-05-26Auto merge of #124661 - RalfJung:only-structural-consts-in-patterns, r=pnkfelixbors-176/+24
Turn remaining non-structural-const-in-pattern lints into hard errors This completes the implementation of https://github.com/rust-lang/rust/issues/120362 by turning our remaining future-compat lints into hard errors: indirect_structural_match and pointer_structural_match. They have been future-compat lints for a while (indirect_structural_match for many years, pointer_structural_match since Rust 1.75 (released Dec 28, 2023)), and have shown up in dependency breakage reports since Rust 1.78 (just released on May 2, 2024). I don't expect a lot of code will still depend on them, but we will of course do a crater run. A lot of cleanup is now possible in const_to_pat, but that is deferred to a later PR. Fixes https://github.com/rust-lang/rust/issues/70861
2024-05-20Move 100 entries from tests/ui into subdirsJubilee Young-0/+205
- Move super-fast-paren-parsing test into ui/parser - Move stmt_expr_attrs test into ui/feature-gates - Move macro tests into ui/macros - Move global_asm tests into ui/asm - Move env tests into ui/process - Move xcrate tests into ui/cross-crate - Move unop tests into ui/unop - Move backtrace tests into ui/backtrace - Move check-static tests into ui/statics - Move expr tests into ui/expr - Move optimization fuel tests into ui/fuel - Move ffi attribute tests into ui/ffi-attrs - Move suggestion tests into ui/suggestions - Move main tests into ui/fn-main - Move lint tests into ui/lint - Move repr tests into ui/repr - Move intrinsics tests into ui/intrinsics - Move tool lint tests into ui/tool-attributes - Move return tests into ui/return - Move pattern tests into ui/patttern - Move range tests into ui/range - Move foreign-fn tests into ui/foreign - Move orphan-check tests into ui/coherence - Move inference tests into ui/inference - Reduce ROOT_ENTRY_LIMIT
2024-05-15"No `ref mut` behind `&`" on all editionsJules Bertholet-0/+9
2024-05-15Gate implicit mutable by-reference bindings behind `mut ref`Jules Bertholet-49/+4
2024-05-13`rustc_hir_typeck`: Account for `skipped_ref_pats` in `expr_use_visitor`Jules Bertholet-0/+42
Fixes #125058
2024-05-12Match ergonomics 2024: migration lintJules Bertholet-47/+223
Unfortunately, we can't always offer a machine-applicable suggestion when there are subpatterns from macro expansion. Co-Authored-By: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
2024-05-03turn pointer_structural_match into a hard errorRalf Jung-164/+24
2024-05-03remove IndirectStructuralMatch lint, emit the usual hard error insteadRalf Jung-12/+0
2024-05-02Stabilize exclusive_rangeRoss Smyth-112/+93
2024-04-29Change wordingest31-3/+3
2024-04-28Add a note to the ArbitraryExpressionInPattern errorest31-0/+3
2024-04-25Auto merge of #119650 - chenyukang:yukang-fix-118596-ref-mut, r=wesleywiserbors-16/+40
Suggest ref mut for pattern matching assignment Fixes #118596
2024-04-24Mention when type parameter could be `Clone`Esteban Küber-2/+8
``` error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:7:9 | LL | fn duplicate_t<T>(t: T) -> (T, T) { | - move occurs because `t` has type `T`, which does not implement the `Copy` trait ... LL | (t, t) | - ^ value used here after move | | | value moved here | help: if `T` implemented `Clone`, you could clone the value --> $DIR/use_of_moved_value_copy_suggestions.rs:4:16 | LL | fn duplicate_t<T>(t: T) -> (T, T) { | ^ consider constraining this type parameter with `Clone` ... LL | (t, t) | - you could clone this value help: consider restricting type parameter `T` | LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) { | ++++++ ``` The `help` is new. On ADTs, we also extend the output with span labels: ``` error[E0507]: cannot move out of static item `FOO` --> $DIR/issue-17718-static-move.rs:6:14 | LL | let _a = FOO; | ^^^ move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> $DIR/issue-17718-static-move.rs:1:1 | LL | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL | let _a = FOO; | --- you could clone this value help: consider borrowing here | LL | let _a = &FOO; | + ```
2024-04-25Suggest ref mut for pattern matching assignmentyukang-16/+40
2024-04-20Test or-patterns inside deref patternsNadrieril-1/+13
2024-04-20Use deep fake borrows for deref patternsNadrieril-0/+26
2024-04-20Address closure-related reviewNadrieril-0/+21
2024-04-20Allow mutable bindings inside deref patternsNadrieril-0/+15
2024-04-20Don't fake borrow inside a deref patternNadrieril-2/+2