Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information