MIR-borrowck: should distinguish "uninitalized" from "moved out of" #45363
Labels
A-borrow-checker
Area: The borrow checker
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The AST-borrowck is often able to distinguish a path that was never assigned into (i.e. "uninitialized") from a path that had previously held a value but that value was subsequently moved elsewhere (i.e. "moved out of").
The MIR-borrowck currently uniformly reports both cases as instances of "uninitialized" state.
As an example: for the test
src/test/compile-fail/borrowck/borrowck-loan-in-overloaded-op.rs
, we have these diagnostics emitted:The first one is AST-borrowck, the second one MIR-borrowck.
Note in particular that AST-borrowck not only uses more precise language, but more importantly, it reports the specific span where the preceding move out occurred. This is perhaps the most important aspect of the diagnostic (especially for new-comers to Rust and move-semantics).
The text was updated successfully, but these errors were encountered: