about summary refs log tree commit diff
path: root/tests/ui/pattern
AgeCommit message (Collapse)AuthorLines
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
2024-04-20Lower deref patterns to MIRNadrieril-6/+174
This handles using deref patterns to choose the correct match arm. This does not handle bindings or guards. Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
2024-04-15Fix testsJules Bertholet-4/+5
2024-04-15Rename feature gateJules Bertholet-12/+12
2024-04-15Temporarily remove future compatibility label from migration lintJules Bertholet-8/+2
The lint is unstable, and the lint group `rust_2024_compatibility` must keep working on stable
2024-04-15Migration lintJules Bertholet-0/+53
Rustfix remains TODO
2024-04-15Match ergonomics 2024: `mut` doesn't reset binding modeJules Bertholet-0/+106
2024-04-11Mention when the type of the moved value doesn't implement `Clone`Esteban Küber-0/+10
2024-04-11Fix accuracy of `T: Clone` check in suggestionEsteban Küber-6/+0
2024-04-11Account for unops when suggesting cloningEsteban Küber-2/+3
2024-04-11Suggest `.clone()` when moved while borrowedEsteban Küber-0/+5
2024-04-01Fix union handling in exhaustivenessNadrieril-11/+12
2024-03-31Add testsNadrieril-0/+68
2024-03-27Feature gateJules Bertholet-0/+125
2024-03-25Require DerefMut if deref pattern has nested ref mut bindingMichael Goulet-0/+37
2024-03-22Validate that we're only matching on unit struct for path patternMichael Goulet-0/+65
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-4/+4
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
2024-03-20Add barest-bones deref patternsNadrieril-0/+31
Co-authored-by: Deadbeef <ent3rm4n@gmail.com>