Closed
Description
Consider the following (play):
pub fn capture_assign_whole(x: (i32,)) {
|| { x = (1,); };
}
fn main() {
capture_assign_whole((1000,));
}
Under both AST-borrowck and #![feature(nll)]
, it errors.
But under NLL migration mode (the default for the 2018 edition), it downgrades the error to a warning.
My current hypothesis (which has been supported by inspecting RUST_LOG output) is that after the migrate mode encounters the NLL error, when it runs the AST-borrowck to see if it also errors, it runs the borrowck only on the closure body, not the parent, which means it misses the mutable borrow that occurs when the mutable capture occurs in the parent for an immutable binding x
.