about summary refs log tree commit diff
path: root/src/test/ui/match
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1848/+0
2022-12-27Account for `match` expr in single lineEsteban Küber-0/+15
When encountering `match Some(42) { Some(x) => x, None => "" };`, output ``` error[E0308]: `match` arms have incompatible types --> f53.rs:2:52 | 2 | let _ = match Some(42) { Some(x) => x, None => "" }; | -------------- - ^^ expected integer, found `&str` | | | | | this is found to be of type `{integer}` | `match` arms have incompatible types ```
2022-12-23Move testsCaio-0/+40
2022-12-13review commentsEsteban Küber-3/+3
2022-12-13Suggest `: Type` instead of `: _`Esteban Küber-3/+3
2022-12-13Suggest `collect`ing into `Vec<_>`Esteban Küber-1/+1
2022-11-05Move some tests to more reasonable directoriesCaio-0/+45
2022-10-08Stabilize half_open_range_patternsUrgau-18/+15
2022-10-08Split slice part of feature(half_open_range_patterns) to [...]_in_slicesUrgau-1/+1
2022-10-01bless ui testsMaybe Waffle-2/+2
2022-09-03Include enum path in variant suggestionMichael Goulet-5/+5
2022-08-07Remove even more box syntax uses from src/testest31-4/+3
Prior work, notably 6550021124451628b1efc60c59284465b109e3aa from #88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. Some tests that are very box syntax specific are not being migrated.
2022-07-01Shorten def_span for more items.Camille GILLOT-2/+2
2022-06-21Move some tests to more reasonable directoriesCaio-0/+28
2022-06-16 fix one more case of trailing spaceklensy-1/+1
2022-06-03Fully stabilize NLLJack Huey-58/+4
2022-06-03Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebankbors-1/+6
rewrite error handling for unresolved inference vars Pretty much completely rewrites `fn emit_inference_failure_err`. This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments. Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs. r? `@estebank` `@petrochenkov`
2022-06-02add new `emit_inference_failure_err`lcnr-1/+6
2022-05-28Move some tests to more reasonable placesCaio-0/+34
2022-05-22Use revisions for NLL in const-generics and matchJack Huey-10/+22
2022-05-20Move testsCaio-0/+28
2022-04-23Bless pretty-print output.Camille GILLOT-1/+1
2022-04-06regression test for #82866Michael Goulet-0/+23
2022-04-04Format invariance notes with backticksMichael Goulet-2/+2
2022-03-27Point (again) to more expressions with their type, even if not fully resolvedEsteban Kuber-0/+2
2022-03-08Change wording of suggestion to add missing `match` armEsteban Kuber-3/+3
2022-03-08Point at uncovered variants in enum definition in `note` instead of a ↵Esteban Kuber-6/+15
`span_label` This makes the order of the output always consistent: 1. Place of the `match` missing arms 2. The `enum` definition span 3. The structured suggestion to add a fallthrough arm
2022-03-08When finding a match expr with multiple arms that requires more, suggest itEsteban Kuber-1/+4
Given ```rust match Some(42) { Some(0) => {} Some(1) => {} } ``` suggest ```rust match Some(42) { Some(0) => {} Some(1) => {} None | Some(_) => todo!(), } ```
2022-03-08When finding a match expr with a single arm that requires more, suggest itEsteban Kuber-1/+4
Given ```rust match Some(42) { Some(0) => {} } ``` suggest ```rust match Some(42) { Some(0) => {} None | Some(_) => todo!(), } ```
2022-03-08When encountering a match expr with no arms, suggest itEsteban Kuber-3/+8
Given ```rust match Some(42) {} ``` suggest ```rust match Some(42) { None | Some(_) => todo!(), } ```
2022-01-31Bless all pretty printer tests and ui testsDavid Tolnay-3/+2
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-10/+8
2022-01-21Rollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obkMatthias Krüger-2/+2
Ensure that early-bound function lifetimes are always 'local' During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2022-01-01Move `PatKind::Lit` checking from ast_validation to ast loweringAaron Hill-4/+4
Fixes #92074 This allows us to insert an `ExprKind::Err` when an invalid expression is used in a literal pattern, preventing later stages of compilation from seeing an unexpected literal pattern.
2021-12-31Ensure that early-bound function lifetimes are always 'local'Aaron Hill-2/+2
During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2021-12-27Visit patterns' literal expressions before binding new identsMichael Goulet-0/+46
2021-11-28suggest cast char -> intcameron-0/+5
2021-11-20Fix for issue 91058Michael Goulet-0/+22
2021-11-18Move some tests to more reasonable directoriesCaio-0/+7
2021-11-06Move some tests to more reasonable directoriesCaio-0/+80
2021-10-13Remove textual span from diagnostic stringOli Scherer-4/+4
2021-09-25Use larger span for adjustments on method callsAaron Hill-1/+1
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-15Move some tests to more reasonable directoriesCaio-0/+304
2021-08-25Adjust spansNoah Lev-1/+1
* Highlight the whole pattern if it has no fields * Highlight the whole definition if it has no fields * Only highlight the pattern name if the pattern is multi-line * Determine whether a pattern is multi-line based on distance from name to last field, rather than first field
2021-08-21Make E0023 spans even more preciseNoah Lev-5/+3
2021-08-17Make spans for tuple patterns in E0023 more preciseNoah Lev-2/+4
As suggested in #86307.
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-6/+5
2021-08-11Modify structured suggestion outputEsteban Küber-2/+2
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-0/+6
2021-05-12Improve error message for non-exhaustive matches on non-exhaustive enumsFabian Wolff-0/+73