Commit Graph

144 Commits

Author SHA1 Message Date
Yuki Okushi
6ec3a63bb2 Add test for issue-66270 2019-12-23 07:42:26 +09:00
Mazdak Farrokhzad
eac5fb8b0a Rollup merge of #67189 - LeSeulArtichaut:binop-wording, r=estebank
Unify binop wording

Closes #60497
r? @estebank
2019-12-19 10:29:51 +01:00
Niko Matsakis
1719337d02 Revert "Remove #![feature(never_type)] from tests."
This reverts commit 8f6197f39f.
2019-12-14 09:01:04 -05:00
LeSeulArtichaut
eac6fac10b Update tests 2019-12-12 20:56:14 +01:00
LeSeulArtichaut
3bd46f1aec Update UI test expectations 2019-12-12 20:56:14 +01:00
Nadrieril
fbd2cd09e6 Revert a diagnostic change in the case of integer ranges 2019-12-11 18:17:58 +00:00
Nadrieril
40f434b8c5 Reuse adt_defined_here 2019-12-04 16:43:24 +00:00
Nadrieril
2216318484 Use the default code path to list missing patterns
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-04 16:43:24 +00:00
Nadrieril
e444346b12 List missing constructors in an almost empty match
Actually empty matches are still handled by a different code path
2019-12-04 16:43:24 +00:00
Nadrieril
5a3b7d2055 Add tests 2019-12-04 16:43:24 +00:00
Nadrieril
c0f3c06c6d Only warn about missing patterns in the case of an enum 2019-12-04 16:43:21 +00:00
Nadrieril
2099dd1aa2 Add tests 2019-12-04 16:43:21 +00:00
Nadrieril
5628d4a7c3 Make empty match lint more consistent under exhaustive_patterns 2019-12-04 16:43:21 +00:00
Nadrieril
1c77a049b9 Fix erroneous comment 2019-12-04 16:43:21 +00:00
Nadrieril
1bd97ae8a1 Tweak error on empty match 2019-12-04 16:43:21 +00:00
Nadrieril
922310d60f Add tests 2019-12-04 16:43:21 +00:00
Nadrieril
1c1bec2f6d Remove top-level or-pattern hack 2019-12-02 16:03:03 +00:00
Nadrieril
a476af22e8 Correct error on partially unreachable or-pat in if let 2019-12-02 16:03:03 +00:00
Nadrieril
00ccadf43f Add some tests 2019-12-02 16:00:24 +00:00
bors
f453d1127d Auto merge of #66603 - Nadrieril:fix-65413, r=varkor
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-28 14:22:47 +00:00
bors
53712f8637 Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
2019-11-21 17:53:19 +00:00
Mazdak Farrokhzad
8f6197f39f Remove #![feature(never_type)] from tests.
Also remove `never_type` the feature-gate test.
2019-11-21 14:55:32 +01:00
Nadrieril
5510f5589e Use appropriate constructor for const slices 2019-11-21 11:20:46 +00:00
Nadrieril
fa4a4d3eda Add some tests 2019-11-21 11:20:46 +00:00
Esteban Küber
6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber
b2e6aef073 review comments: tweak prefix strings 2019-11-18 11:02:44 -08:00
Esteban Küber
83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Nadrieril Feneanar
2079ae3a52 Update src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-18 15:40:49 +00:00
Nadrieril
daa117eab7 Small improvement to exhaustiveness diagnostics 2019-11-17 17:59:37 +00:00
Nadrieril
5b420a9dc4 Add regression test for issue 53820 2019-11-16 16:43:55 +00:00
Nadrieril
d93c1b320c Introduce new FixedLenSlice constructor
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-16 16:43:20 +00:00
Nadrieril
c00ecfa8d2 Add some tests 2019-11-16 16:18:46 +00:00
Nadrieril
cde9808eaa Add regression test 2019-11-15 16:55:38 +00:00
Nadrieril Feneanar
9165dd056b Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15 16:55:37 +00:00
Nadrieril
c38aad4f4b Add test for failing try_eval_bits 2019-11-15 16:55:37 +00:00
Yuki Okushi
302cf6db74 Tweak non-char/numeric in range pattern diagnostic 2019-11-13 08:27:53 +09:00
Nadrieril
098974dadd Split slice-patterns test as suggested by Centril 2019-11-06 15:27:21 +00:00
Nadrieril
9531787ae5 Move a few more tests to the usefulness/ folder 2019-11-05 18:40:55 +00:00
Nadrieril
f774eb69fd Use VarLenSlice consistently when splitting constructors
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-05 18:32:26 +00:00
Nadrieril
58de9d9a13 Add some test cases 2019-11-05 17:59:01 +00:00
Nadrieril
65bc67e8d9 Make exhaustiveness error message more consistent for slice patterns
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-05 17:59:01 +00:00
Nadrieril
b66973043e Don't use max_slice_length when subtracting from VarLenSlice
This alters error messages slightly, but that'll be improved later
2019-11-05 17:59:01 +00:00
Nadrieril
4dc5697bd2 Add some slice-pattern exhaustiveness tests 2019-11-05 11:36:22 +00:00
bors
b43a682259 Auto merge of #65759 - tmiasko:ui, r=petrochenkov
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-03 15:14:09 +00:00
Tomasz Miąsko
dae4c6e722 Update error annotations in tests that successfully compile
Those annotation are silently ignored rather than begin validated
against compiler output. Update them before validation is enabled,
to avoid test failures.
2019-11-02 10:28:29 +01:00
Eduard-Mihai Burtescu
680089c2d9 Revert "pre-expansion gate box_patterns"
This reverts commit 2aff6b36d7.
2019-10-31 19:08:11 +02:00
bors
8d78bf6b27 Auto merge of #65421 - estebank:variants, r=petrochenkov
Point at local similarly named element and tweak references to variants

Partially address #65386.
2019-10-28 13:41:13 +00:00
Nadrieril
09f9947ebc Gather together usefulness tests
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-27 21:20:26 +00:00
Esteban Küber
b26ddb8af3 Point at local similarly named element and tweak references to variants
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-27 11:50:43 -07:00