Commit ab8a67c
committed
Auto merge of rust-lang#51729 - matthewjasper:move-errors, r=nikomatsakis
[NLL] Better move errors
Make a number of changes to improve the quality of NLL cannot move errors.
* Group errors that occur in the same `match` with the same cause.
* Suggest `ref`, `&` or removing `*` to avoid the move.
* Show the place being matched on.
Differences from AST borrowck:
* `&` is suggested over `ref` when matching on a place that can't be moved from.
* Removing `*` is suggested instead of adding `&` when applicable.
* Sub-pattern spans aren't used, this would probably need Spans on Places.
Closes rust-lang#45699
Closes rust-lang#46627
Closes rust-lang#51187
Closes rust-lang#51189
r? @pnkfelixFile tree
42 files changed
+997
-321
lines changed- src
- librustc_mir
- borrow_check
- build
- expr
- matches
- dataflow/move_paths
- hair
- librustc/mir
- test
- compile-fail/borrowck
- mir-opt
- nll
- ui
- borrowck
- codemap_tests
- error-codes
- issue-40402-ref-hints
- nll
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+997
-321
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
501 | | - | |
| 500 | + | |
| 501 | + | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
511 | 518 | | |
512 | 519 | | |
513 | | - | |
514 | | - | |
| 520 | + | |
| 521 | + | |
515 | 522 | | |
516 | | - | |
| 523 | + | |
517 | 524 | | |
518 | 525 | | |
519 | 526 | | |
520 | 527 | | |
521 | | - | |
| 528 | + | |
522 | 529 | | |
523 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
524 | 539 | | |
525 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
526 | 554 | | |
527 | 555 | | |
528 | 556 | | |
| |||
542 | 570 | | |
543 | 571 | | |
544 | 572 | | |
545 | | - | |
| 573 | + | |
546 | 574 | | |
547 | 575 | | |
548 | 576 | | |
| |||
670 | 698 | | |
671 | 699 | | |
672 | 700 | | |
| 701 | + | |
673 | 702 | | |
674 | 703 | | |
675 | 704 | | |
| |||
688 | 717 | | |
689 | 718 | | |
690 | 719 | | |
| 720 | + | |
691 | 721 | | |
692 | 722 | | |
693 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 150 | + | |
184 | 151 | | |
185 | 152 | | |
186 | 153 | | |
| |||
0 commit comments