about summary refs log tree commit diff
path: root/src/test/ui/match
AgeCommit message (Collapse)AuthorLines
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
2021-05-02add suggestion for unit enum variant when matched with a paternAliénore Bouttefeux-1/+4
2021-04-23add tests for new behaviorSmitty-0/+47
2021-03-19update testsmark-2/+0
2021-01-12Include `..` suggestion if fields are all wildcardsCamelid-0/+4
2021-01-12Always show suggestions in their own subwindowsCamelid-4/+6
2021-01-12Only suggest `..` if more than one field is missingCamelid-10/+4
2021-01-12Specialize `..` help message for all fields vs. the restCamelid-1/+1
2021-01-12Suggest `Variant(..)` if all of the mentioned fields are `_`Camelid-2/+2
2021-01-12Suggest `_` and `..` if a pattern has too few fieldsCamelid-0/+9
For example, this code: struct S(i32, f32); let S(x) = S(0, 1.0); will make the compiler suggest either: let S(x, _) = S(0, 1.0); or: let S(x, ..) = S(0, 1.0);
2020-11-19Regroup many usefulness-related test in the same folderNadrieril-91/+0
2020-11-17Rollup merge of #79072 - oli-obk:byte_str_pat, r=estebankMara Bos-0/+57
Fix exhaustiveness in case a byte string literal is used at slice type fixes #79048
2020-11-17Fix exhaustiveness in case a byte string literal is used at slice typeoli-0/+57
2020-11-14Style nitWho? Me?!-1/+1
Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
2020-11-09address reviewer commentsmark-23/+23
2020-11-07fix #72680 by explicitly checking for or-pattern before testmark-0/+65
2020-10-22Reduce diagram mess in 'match arms have incompatible types' errorDavid Tolnay-26/+22
2020-10-22Add test of incompatible match arm types with multiline armDavid Tolnay-1/+29
2020-09-30References to ZSTs may be at arbitrary aligned addressesOliver Scherer-0/+9
2020-09-26`char` not charvarkor-6/+6
2020-09-23Deduplicate errors in const to pat conversionOliver Scherer-8/+1
2020-09-20Use precise errors during const to pat conversion instead of a catch-all on ↵Oliver Scherer-3/+10
the main constant
2020-09-20Implement destructuring for all aggregates and for referencesOliver Scherer-0/+46
2020-08-18Provide better spans for the match arm without tail expressionWonwoo Choi-0/+116
2020-07-08Correctly mark the ending span of a match armAyaz Hafiz-0/+28
Closes #74050 r? @matthewjasper
2020-06-02normalize adt fields during structural match checkBastian Kauschke-0/+23
2020-05-08Skip tests on emscriptenYuki Okushi-0/+5
2020-05-06Move tests from `test/run-fail` to UIYuki Okushi-0/+77
2020-04-29emit err when using trait objects in patBastian Kauschke-0/+18
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+1
2020-03-12update testsMark Mansi-2/+2
2020-03-06When encountering an Item in a pat context, point at the item defEsteban Küber-0/+3
2020-02-25check_pat_path: use pattern_causeMazdak Farrokhzad-1/+3
2020-02-25enhance check_pat_lit with TopInfoMazdak Farrokhzad-0/+3
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-2/+0
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-1/+1
2020-01-24Normalise notes with the/isvarkor-1/+1
2020-01-18slice_patterns: organize some testsMazdak Farrokhzad-72/+0
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-7/+5
2020-01-09Update testsVadim Petrochenkov-3/+24
2020-01-05Add backticks to various diagnosticsvarkor-8/+8
2019-12-30MatchExpressionArmPattern: Use more generic wording.Mazdak Farrokhzad-2/+2
The existing wording was inappropriate for e.g. `if let Ok(_) = expr { .. }`. The diagnostic would leak the fact that we desugar to a `match`.