Commit 142bb27
committed
Auto merge of rust-lang#53147 - ashtneoi:dont-suggest-ref, r=estebank
For move errors, suggest match ergonomics instead of `ref`
Partially fixes issue rust-lang#52423. Also makes errors and suggestions more consistent between move-from-place and move-from-value errors.
Limitations:
- Only the first pattern in a match arm can have a "consider removing this borrow operator" suggestion.
- Suggestions don't always compile as-is (see the TODOs in the test for details).
Sorry for the really long test. I wanted to make sure I handled every case I could think of, and it turned out there were a lot of them.
Questions:
- Is there any particular applicability I should set on those suggestions?
- Are the notes about the `Copy` trait excessive?File tree
49 files changed
+3104
-279
lines changed- src
- librustc_borrowck/borrowck
- librustc_mir
- borrow_check
- build
- matches
- util
- librustc/mir
- test/ui
- borrowck
- codemap_tests
- disallowed-deconstructing
- error-codes
- issues
- issue-40402-ref-hints
- moves
- nll
- suggestions/dont-suggest-ref
- tools/compiletest/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+3104
-279
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
433 | | - | |
| 432 | + | |
| 433 | + | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
| 527 | + | |
526 | 528 | | |
527 | 529 | | |
528 | 530 | | |
| |||
540 | 542 | | |
541 | 543 | | |
542 | 544 | | |
543 | | - | |
| 545 | + | |
| 546 | + | |
544 | 547 | | |
545 | 548 | | |
546 | 549 | | |
| |||
673 | 676 | | |
674 | 677 | | |
675 | 678 | | |
676 | | - | |
| 679 | + | |
677 | 680 | | |
678 | 681 | | |
679 | 682 | | |
| |||
710 | 713 | | |
711 | 714 | | |
712 | 715 | | |
| 716 | + | |
713 | 717 | | |
714 | 718 | | |
715 | 719 | | |
| |||
729 | 733 | | |
730 | 734 | | |
731 | 735 | | |
| 736 | + | |
732 | 737 | | |
733 | 738 | | |
734 | 739 | | |
| |||
906 | 911 | | |
907 | 912 | | |
908 | 913 | | |
909 | | - | |
| 914 | + | |
910 | 915 | | |
911 | 916 | | |
912 | 917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1235 | 1235 | | |
1236 | 1236 | | |
1237 | 1237 | | |
1238 | | - | |
| 1238 | + | |
1239 | 1239 | | |
1240 | 1240 | | |
1241 | 1241 | | |
| |||
0 commit comments