about summary refs log tree commit diff
path: root/src/test/ui/or-patterns
AgeCommit message (Collapse)AuthorLines
2021-12-14Make TyS::is_suggestable more structualMichael Goulet-6/+4
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-1/+16
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-08-11Modify structured suggestion outputEsteban Küber-1/+1
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-1/+1
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-04-28fix testmark-0/+1
2021-04-27unignore a couple of testsmark-4/+0
2021-03-19update testsmark-479/+136
2021-03-05use pat<no_top_alt> for patterns in let bindingsmark-275/+457
2021-02-15Simplify pattern grammar by allowing nested leading vertmark-211/+73
Along the way, we also implement a handful of diagnostics improvements and fixes, particularly with respect to the special handling of `||` in place of `|` and when there are leading verts in function params, which don't allow top-level or-patterns anyway.
2021-02-07Auto merge of #80632 - Nadrieril:fix-80501, r=varkorbors-12/+67
Identify unreachable subpatterns more reliably In https://github.com/rust-lang/rust/pull/80104 I used `Span`s to identify unreachable sub-patterns in the presence of or-patterns during exhaustiveness checking. In https://github.com/rust-lang/rust/issues/80501 it was revealed that `Span`s are complicated and that this was not a good idea. Instead, this PR identifies subpatterns logically: as a path in the tree of subpatterns of a given pattern. I made a struct that captures a set of such subpatterns. This is a bit complex, but thankfully self-contained; the rest of the code does not need to know anything about it. Fixes https://github.com/rust-lang/rust/issues/80501. I think I managed to keep the perf neutral. r? `@varkor`
2021-02-06path trimming: ignore type aliasesDan Aloni-1/+1
2021-02-03move test to be with the othersmark-0/+44
2021-01-24Identify subpatterns by the path to them instead of spansNadrieril-3/+14
2021-01-24Factor or-pattern expansionNadrieril-13/+22
2021-01-24Add testsNadrieril-10/+45
2020-12-20Auto merge of #80100 - mark-i-m:pattORns-2, r=petrochenkovbors-43/+64
or_patterns: implement :pat edition-specific behavior cc #54883 `@joshtriplett` This PR implements the edition-specific behavior of `:pat` wrt or-patterns, as determined by the crater runs and T-lang consensus in https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090. I believe this can unblock stabilization of or_patterns. r? `@petrochenkov`
2020-12-19implement edition-specific :pat behavior for 2015/18mark-43/+64
2020-12-18Merge unreachable subpatterns correctlyNadrieril-16/+8
2020-12-18Rewrite usefulness merging using `SpanSet`Nadrieril-2/+8
`SpanSet` is heavily inspired from `DefIdForest`.
2020-12-18Add testsNadrieril-5/+48
2020-11-05Emit lints in the order in which they occur in the file.Nadrieril-4/+4
2020-11-05Fix unreachable sub-branch detectionNadrieril-6/+12
This fixes https://github.com/rust-lang/rust/issues/76836
2020-11-05Add testNadrieril-4/+11
2020-09-02pretty: trim paths of unique symbolsDan Aloni-15/+15
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-07-04Fix #71977Nadrieril-12/+51
2020-06-28Update testsDylan MacKenzie-63/+1
2020-06-26Show the values and computation that would overflow a const evaluation or ↵Oliver Scherer-13/+13
propagation
2020-06-13Prefer the associated consts for pattern matching errorLzu Tao-13/+13
2020-06-04resolve: Sort E0408 errors by Symbol strTom Eccles-13/+13
Previously errors were sorted by Symbol index instead of the string. The indexes are not the same between architectures because Symbols for architecture extensions (e.g. x86 AVX or RISC-V d) are interned before the source file is parsed. RISC-V's naming of extensions after single letters led to it having errors sorted differently for test cases using single letter variable names. Instead sort the errors by the Symbol string so that it is stable across architectures.
2020-05-10Auto merge of #71557 - matthewjasper:mir-asymmetric-or-pattern, r=oli-obkbors-0/+51
Fix ICE for broken or-pattern in async fn closes #71297
2020-04-29Bless testsDylan MacKenzie-17/+2
2020-04-19Fix ICE for broken or-pattern in async fnMatthew Jasper-0/+51
2020-03-27Rollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebankMazdak Farrokhzad-0/+5
non-exhastive diagnostic: add note re. scrutinee type This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note: ``` = note: the matched value is of type &[i32] ``` to non-exhaustive pattern matching errors. r? @varkor @estebank
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+5
2020-03-26Add tests based on issue #70372 commentsAmin Arria-0/+22
2020-03-10Matrix::push: recursively expand or-patternsMazdak Farrokhzad-0/+43
2020-03-08Rollup merge of #69599 - Centril:typeck-tweak-wording, r=davidtwcoMazdak Farrokhzad-8/+8
check_binding_alt_eq_ty: improve precision wrt. `if let` Follow up to https://github.com/rust-lang/rust/pull/69452 -- this tweaks the `check_binding_alt_eq_ty` logic wrt. wording so that `if let` doesn't include "in this arm" (because there can only ever be one arm). r? @estebank
2020-03-07Rollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebankMazdak Farrokhzad-20/+20
resolve, inconsistent binding mode: tweak wording Now that we can have e.g. `let Ok(x) | Err(x) = res;`, it's no longer appropriate to refer to "the same *match arm*", so let's tweak the wording. r? @estebank
2020-03-04fix tidy errorMatthew Kuo-1/+2
2020-03-04test(pattern): harden tests for or-patterns with slice-patternsMatthew Kuo-2/+12
Some of the nested OR paths were being missed
2020-03-04test(pattern): add tests for combinations of pattern featuresMatthew Kuo-0/+79
Reference issue #67311 Tests combinations of the following pattern features: - bindings_after_at - or_patterns - slice_patterns - box_patterns
2020-03-04resolve, inconsistent binding mode: tweak wording.Mazdak Farrokhzad-20/+20
2020-03-01check_binding_alt_eq_ty: improve precision wrt. `if let`.Mazdak Farrokhzad-8/+8
2020-02-25improve or-pattern type consistency diagnosticsMazdak Farrokhzad-51/+131
2020-02-15Rollup merge of #68856 - Centril:or-pat-ref-pat, r=matthewjasperYuki Okushi-13/+383
typeck: clarify def_bm adjustments & add tests for or-patterns Clarify the adjustment algorithm for the expected type / default binding-modes when type checking patterns with more documentation and tweaks that make the algorithm more independent of the pattern forms. Also resolve the FIXME noted for or-patterns by deciding that the current implementation is correct, noting the rationale and adding tests for the current implementation. cc https://github.com/rust-lang/rust/issues/54883 r? @oli-obk @varkor
2020-02-09--bless --compare-mode=nllMatthias Prechtl-27/+27
2020-02-05or_patterns: test default binding modesMazdak Farrokhzad-0/+132
2020-02-05or_patterns: rename previous testMazdak Farrokhzad-22/+22
2020-02-05or_patterns: harden bindings testMazdak Farrokhzad-7/+245
2020-02-05or_patterns: add regression test for 68785Mazdak Farrokhzad-0/+14