summary refs log tree commit diff
path: root/src/test/ui/destructuring-assignment
AgeCommit message (Collapse)AuthorLines
2021-08-25Adjust spansNoah Lev-4/+4
* 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-20/+12
2021-08-17Make spans for tuple patterns in E0023 more preciseNoah Lev-8/+16
As suggested in #86307.
2021-08-11Modify structured suggestion outputEsteban Küber-6/+6
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-04-17Move some tests to more reasonable directories - 6Caio-0/+78
2021-01-26Tweak suggestion for missing field in patternsEsteban Küber-4/+4
Account for parser recovered struct and tuple patterns to avoid invalid suggestion. Follow up to #81103.
2021-01-16don't suggest erroneous trailing comma after `..`Zack M. Davis-2/+2
In #76612, suggestions were added for missing fields in patterns. However, the suggestions are being inserted just at the end of the last field in the pattern—before any trailing comma after the last field. This resulted in the "if you don't care about missing fields" suggestion to recommend code with a trailing comma after the field ellipsis (`..,`), which is actually not legal ("`..` must be at the end and cannot have a trailing comma")! Incidentally, the doc-comment on `error_unmentioned_fields` was using `you_cant_use_this_field` as an example field name (presumably copy-paste inherited from the description of Issue #76077), but the present author found this confusing, because unmentioned fields aren't necessarily unusable. The suggested code in the diff this commit introduces to `destructuring-assignment/struct_destructure_fail.stderr` doesn't work, but it didn't work beforehand, either (because of the "found reserved identifier `_`" thing), so you can't really call it a regression; it could be fixed in a separate PR. Resolves #78511.
2021-01-12Include `..` suggestion if fields are all wildcardsCamelid-0/+8
2021-01-12Always show suggestions in their own subwindowsCamelid-8/+12
2021-01-12Only suggest `..` if more than one field is missingCamelid-20/+8
2021-01-12Specialize `..` help message for all fields vs. the restCamelid-2/+2
2021-01-12Suggest `Variant(..)` if all of the mentioned fields are `_`Camelid-4/+4
2021-01-12Suggest `_` and `..` if a pattern has too few fieldsCamelid-0/+18
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-18Test drop order for (destructuring) assignmentsFabian Zaiser-0/+44
2020-11-14Add underscore expressions for destructuring assignmentsFabian Zaiser-16/+105
Co-authored-by: varkor <github@varkor.com>
2020-11-11Implement destructuring assignment for structs and slicesFabian Zaiser-30/+315
Co-authored-by: varkor <github@varkor.com>
2020-11-07Implement destructuring assignment for tuplesFabian Zaiser-39/+159
Co-authored-by: varkor <github@varkor.com>
2020-02-17Do not emit note suggesting to implement trait to foreign typeLeSeulArtichaut-4/+0
Update tests Extend to other operations Refractor check in a separate function Fix more tests
2019-12-23Add new folder for destructuring assignment testsvarkor-0/+147