about summary refs log tree commit diff
path: root/src/test/ui/match
AgeCommit message (Collapse)AuthorLines
2019-10-28Auto merge of #65421 - estebank:variants, r=petrochenkovbors-8/+8
Point at local similarly named element and tweak references to variants Partially address #65386.
2019-10-27Gather together usefulness testsNadrieril-928/+0
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-8/+8
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-27update testsMark Mansi-0/+4
2019-10-16Only emit overlapping patterns lint if the overlap is partialEsteban Küber-51/+9
2019-10-16Continue to emit unreachable pattern on cases caught by overlapping patternsEsteban Küber-19/+51
2019-10-16Move overlapping patterns to its own lintEsteban Küber-4/+10
2019-10-16Add check for overlapping ranges to unreachable patterns lintEsteban Küber-27/+37
2019-10-14Rollup merge of #65292 - JohnTitor:add-backticks, r=varkor,CentrilMazdak Farrokhzad-4/+4
Print lifetimes with backticks Fixes #65287 r? @varkor
2019-10-11Print lifetimes with backticksYuki Okushi-4/+4
2019-10-09Suggest `if let` on `let` refutable bindingEsteban Küber-0/+28
2019-09-21Do not trigger unreachable lint in async body and Use span labelsEsteban Küber-6/+3
2019-09-18Point at original span when emitting unreachable lintAaron Hill-0/+5
Fixes #64590 When we emit an 'unreachable' lint, we now add a note pointing at the expression that actually causes the code to be unreachable (e.g. `return`, `break`, `panic`). This is especially useful when macros are involved, since a diverging expression might be hidden inside of a macro invocation.
2019-09-11Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebankbors-0/+242
check_match: refactor + improve non-exhaustive diagnostics for default binding modes Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example: ```rust error[E0004]: non-exhaustive patterns: `&mut &B` not covered --> foo.rs:4:11 | 1 | enum E { A, B } | --------------- | | | | | not covered | `E` defined here ... 4 | match x { | ^ pattern `&mut &B` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms ``` Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`. r? @estebank
2019-09-09check_match: unify check_irrefutable & check_exhaustive more.Mazdak Farrokhzad-17/+43
2019-09-09check_match: refactor + improve non-exhaustive diag for default binding modes.Mazdak Farrokhzad-0/+216
2019-09-08Update tests wrt. bind_by_by_move_pattern_guards stabilization.Mazdak Farrokhzad-2/+0
2019-09-06Update ui testsvarkor-1/+1
2019-09-04Point at variant on pattern field count mismatchEsteban Küber-0/+3
2019-08-13Suggest giving return type to closures on E0282Esteban Küber-4/+1
2019-08-09Be more accurate when mentioning type of found match armsEsteban Küber-0/+41
2019-08-06pretty-pretty extremal constants!Zack M. Davis-2/+2
While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof). The bit-manipulation methods mirror those in `librustc_mir::hair::pattern::_match::all_constructors`; thanks to the immortal Varkor for guidance. Resolves #56393.
2019-07-30Remove 'feature(nll)' from bind_by_move_pattern_guards tests.Mazdak Farrokhzad-1/+1
2019-07-28Rollup merge of #63067 - JohnTitor:test-for-50900, r=CentrilMazdak Farrokhzad-0/+33
Add test for issue-50900 Closes #50900
2019-07-28Move to src/test/ui/match/Yuki Okushi-0/+33
2019-07-28--bless tests due to new subslice syntax.Mazdak Farrokhzad-2/+2
2019-07-28Use new 'p @ ..' syntax in tests.Mazdak Farrokhzad-3/+3
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-06-02Rollup merge of #61441 - estebank:fn-call-in-match, r=varkorMazdak Farrokhzad-2/+6
Tweak wording when encountering `fn` call in pattern Fix #60642
2019-06-01Tweak wording when encountering `fn` call in patternEsteban Küber-2/+6
2019-05-30Update ui and run-pass for ellipsis_inclusive_range_patterns lintmemoryruins-16/+16
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+25
2019-05-01Resolve match arm ty when arms divergeEsteban Küber-17/+42
2019-04-23Auto merge of #60125 - estebank:continue-evaluating, r=oli-obkbors-0/+9
Don't stop evaluating due to errors before borrow checking r? @oli-obk Fix #60005. Follow up to #59903. Blocked on #53708, fixing the ICE in `src/test/ui/consts/match_ice.rs`.
2019-04-22Never stop due to errors before borrow checkingEsteban Küber-0/+9
2019-04-22Remove double trailing newlinesvarkor-2/+0
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-3/+3
2019-03-11Update testsVadim Petrochenkov-36/+36
2019-03-02Point at enum definition when match patterns are not exhaustiveEsteban Küber-2/+26
``` error[E0004]: non-exhaustive patterns: type `X` is non-empty --> file.rs:9:11 | 1 | / enum X { 2 | | A, | | - variant not covered 3 | | B, | | - variant not covered 4 | | C, | | - variant not covered 5 | | } | |_- `X` defined here ... 9 | match x { | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` and `C` not covered --> file.rs:11:11 | 1 | / enum X { 2 | | A, 3 | | B, 4 | | C, | | - not covered 5 | | } | |_- `X` defined here ... 11 | match x { | ^ patterns `C` not covered ``` When a match expression doesn't have patterns covering every variant, point at the enum's definition span. On a best effort basis, point at the variant(s) that are missing. This does not handle the case when the missing pattern is due to a field's enum variants: ``` enum E1 { A, B, C, } enum E2 { A(E1), B, } fn foo() { match E2::A(E1::A) { E2::A(E1::B) => {} E2::B => {} } //~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled } ``` Unify look between match with no arms and match with some missing patterns. Fix #37518.
2019-02-21Add address stability test for matchesMatthew Jasper-0/+39
2019-02-08review comments: (marginally) reduce memory consumtionEsteban Küber-1/+41
2019-02-07Add test for type mismatch on first match armEsteban Küber-0/+58
2019-01-14Auto merge of #57387 - euclio:nonstandard-style-suggestions, r=oli-obkbors-77/+0
Use structured suggestions for nonstandard style lints This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered. Fixes #48103. Fixes #52414.
2019-01-12Don't add label to the match expr when the type is not fully realizedEsteban Küber-2/+0
2019-01-12Reword label as per review commentEsteban Küber-3/+3
2019-01-12Point at the match discriminant when arm pattern has a type mismatchEsteban Küber-1/+7
2019-01-08improve non_upper_case_globals diagnosticsAndy Russell-77/+0
Use a structured suggestion and tighten the span to just the identifier.
2018-12-31Improve type mismatch error messagesYuning Zhang-1/+1
Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.
2018-12-25Remove licensesMark Rousskov-347/+76
2018-12-24make non_camel_case_types an early lintAndy Russell-41/+37