summary refs log tree commit diff
path: root/src/test/ui/pattern
AgeCommit message (Collapse)AuthorLines
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-1/+2
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-11Revert a diagnostic change in the case of integer rangesNadrieril-8/+8
2019-12-04Reuse `adt_defined_here`Nadrieril-10/+43
2019-12-04Use the default code path to list missing patternsNadrieril-48/+60
This uses the exact same code path that would be used for `match x { _ if false => {} }`, since in both cases the resulting matrix is empty. Since we think the behaviour in that case is ok, then we can remove the special case and use the default code path.
2019-12-04List missing constructors in an almost empty matchNadrieril-71/+101
Actually empty matches are still handled by a different code path
2019-12-04Add testsNadrieril-65/+312
2019-12-04Only warn about missing patterns in the case of an enumNadrieril-80/+26
2019-12-04Add testsNadrieril-16/+104
2019-12-04Make empty match lint more consistent under exhaustive_patternsNadrieril-25/+58
2019-12-04Fix erroneous commentNadrieril-8/+7
2019-12-04Tweak error on empty matchNadrieril-2/+2
2019-12-04Add testsNadrieril-0/+229
2019-12-02Remove top-level or-pattern hackNadrieril-12/+5
2019-12-02Correct error on partially unreachable or-pat in `if let`Nadrieril-15/+12
2019-12-02Add some testsNadrieril-0/+134
2019-11-28Auto merge of #66603 - Nadrieril:fix-65413, r=varkorbors-7/+81
Fix #65413 #65413 was due to an oversight in `pat_constructor` that didn't check if a particular const value was maybe a slice/array const.
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-25/+17
Specific labels when referring to "expected" and "found" types
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-2/+1
Also remove `never_type` the feature-gate test.
2019-11-21Use appropriate constructor for const slicesNadrieril-23/+9
2019-11-21Add some testsNadrieril-3/+91
2019-11-18Surround types with backticks in type errorsEsteban Küber-7/+7
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-10/+2
2019-11-18review comments: tweak prefix stringsEsteban Küber-2/+2
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-11/+11
2019-11-18Update src/test/ui/pattern/issue-53820-slice-pattern-large-array.rsNadrieril Feneanar-0/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-17Small improvement to exhaustiveness diagnosticsNadrieril-6/+6
2019-11-16Add regression test for issue 53820Nadrieril-0/+10
2019-11-16Introduce new FixedLenSlice constructorNadrieril-11/+11
It is used in the case where a variable-length slice pattern is used to match on an array of known size. This allows considering only those entries in the array that are captured by one of the patterns. As a side-effect, diagnostics improve a bit for those cases.
2019-11-16Add some testsNadrieril-23/+49
2019-11-15Add regression testNadrieril-0/+6
2019-11-15Apply suggestions from code reviewNadrieril Feneanar-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15Add test for failing `try_eval_bits`Nadrieril-1/+16
2019-11-13Tweak non-char/numeric in range pattern diagnosticYuki Okushi-4/+4
2019-11-06Split slice-patterns test as suggested by CentrilNadrieril-89/+109
2019-11-05Move a few more tests to the usefulness/ folderNadrieril-0/+0
2019-11-05Use VarLenSlice consistently when splitting constructorsNadrieril-21/+21
The previous behaviour ignored slice lengths above a certain length because it could not do otherwise. We now have VarLenSlice however, that can represent the ignored lengths to make the algorithm more consistent. This does not change the correctness of the algorithm, but makes it easier to reason about. As a nice side-effect, exhaustiveness errors have improved: they now capture all missing lengths instead of only the shortest.
2019-11-05Add some test casesNadrieril-1/+31
2019-11-05Make exhaustiveness error message more consistent for slice patternsNadrieril-11/+11
This improves error messages by indicating when slices above a certain lengths have not been matched. Previously, we would only report examples of such lengths, but of course never all of them.
2019-11-05Don't use max_slice_length when subtracting from VarLenSliceNadrieril-2/+2
This alters error messages slightly, but that'll be improved later
2019-11-05Add some slice-pattern exhaustiveness testsNadrieril-0/+213
2019-11-03Auto merge of #65759 - tmiasko:ui, r=petrochenkovbors-2/+2
Validate error patterns and error annotation in ui tests when present Previously, when compilation succeeded, neither error patterns nor error annotation would be validated. Additionally, when compilation failed, only error patterns would be validated if both error patterns and error annotation were present. Now both error patterns and error annotation are validated when present, regardless of compilation status. Furthermore, for test that should run, the error patterns are matched against executable output, which is what some of tests already expect to happen, and when #65506 is merged even more ui tests will. Fixes #56277
2019-11-02Update error annotations in tests that successfully compileTomasz Miąsko-2/+2
Those annotation are silently ignored rather than begin validated against compiler output. Update them before validation is enabled, to avoid test failures.
2019-10-31Revert "pre-expansion gate box_patterns"Eduard-Mihai Burtescu-2/+0
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
2019-10-28Auto merge of #65421 - estebank:variants, r=petrochenkovbors-2/+5
Point at local similarly named element and tweak references to variants Partially address #65386.
2019-10-27Gather together usefulness testsNadrieril-0/+2036
I took most tests that were testing only for match exhaustiveness, pattern refutability or match arm reachability, and put them in the same test folder.
2019-10-27Point at local similarly named element and tweak references to variantsEsteban Küber-2/+5
Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-24pre-expansion gate box_patternsMazdak Farrokhzad-0/+2
2019-09-26Adjust & --bless tests due to no longer downgrading NLL errors on 2015.Mazdak Farrokhzad-31/+3
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-15/+23
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
2019-09-04Point at variant on pattern field count mismatchEsteban Küber-0/+9