Commit 3bd06f4
Ariel Ben-Yehuda
Rollup merge of rust-lang#46231 - ritiek:verbs, r=arielb1
MIR: Fix value moved diagnose messages
rust-lang#45960. I believe this will take a different approach. Simply replacing all nouns to verbs (`desired_action`) messes up the message `use of moved value` (although fixes the message in original issue). Here is what happens:
<pre>
$ rustc -Zborrowck-mir src/test/ui/borrowck/borrowck-reinit.rs
error[E0382]: <b>used</b> of moved value: `x` (Mir)
--> src/test/ui/borrowck/borrowck-reinit.rs:18:16
|
17 | drop(x);
| - value moved here
18 | let _ = (1,x);
| ^ value used here after move
error: aborting due to 2 previous errors
</pre>
(Notice: *"**used** of moved value: `x`"* instead of *"**use**"*)
Which does not seem to be okay.
After experimenting a bit, it looks like [`report_use_of_moved_value()`](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1319) tries to handle both these messages by taking in only one form of`desired_action`.
These messages rise from: *"[{noun} of moved value](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1338-L1342)"* and *"[value {verb} here after move](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1343)"*.
This PR fixes *"value {verb} here after move"* type messages by passing a corresponding verb (`desired_action`) instead of the original noun.File tree
2 files changed
+46
-11
lines changed- src
- librustc_mir
- test/ui/borrowck
2 files changed
+46
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
487 | 515 | | |
488 | 516 | | |
489 | 517 | | |
| |||
574 | 602 | | |
575 | 603 | | |
576 | 604 | | |
577 | | - | |
| 605 | + | |
| 606 | + | |
578 | 607 | | |
579 | 608 | | |
580 | 609 | | |
| |||
600 | 629 | | |
601 | 630 | | |
602 | 631 | | |
603 | | - | |
| 632 | + | |
| 633 | + | |
604 | 634 | | |
605 | 635 | | |
606 | 636 | | |
| |||
619 | 649 | | |
620 | 650 | | |
621 | 651 | | |
622 | | - | |
| 652 | + | |
| 653 | + | |
623 | 654 | | |
624 | 655 | | |
625 | 656 | | |
| |||
720 | 751 | | |
721 | 752 | | |
722 | 753 | | |
723 | | - | |
| 754 | + | |
| 755 | + | |
724 | 756 | | |
725 | 757 | | |
726 | 758 | | |
| |||
772 | 804 | | |
773 | 805 | | |
774 | 806 | | |
775 | | - | |
| 807 | + | |
776 | 808 | | |
777 | 809 | | |
778 | 810 | | |
| |||
943 | 975 | | |
944 | 976 | | |
945 | 977 | | |
946 | | - | |
| 978 | + | |
| 979 | + | |
947 | 980 | | |
948 | 981 | | |
949 | 982 | | |
| |||
1347 | 1380 | | |
1348 | 1381 | | |
1349 | 1382 | | |
1350 | | - | |
| 1383 | + | |
1351 | 1384 | | |
1352 | 1385 | | |
1353 | 1386 | | |
| |||
1357 | 1390 | | |
1358 | 1391 | | |
1359 | 1392 | | |
1360 | | - | |
| 1393 | + | |
1361 | 1394 | | |
1362 | 1395 | | |
1363 | 1396 | | |
| |||
1367 | 1400 | | |
1368 | 1401 | | |
1369 | 1402 | | |
1370 | | - | |
| 1403 | + | |
1371 | 1404 | | |
1372 | 1405 | | |
1373 | 1406 | | |
1374 | | - | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1375 | 1410 | | |
1376 | 1411 | | |
1377 | 1412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
0 commit comments