You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubfncapture_assign_whole(x:(i32,)){
|| { x = (1,);};}fnmain(){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.
The text was updated successfully, but these errors were encountered:
…te-must-look-at-parents-of-closures, r=davidtwco
borrowck=migrate must look at parents of closures
This fixes the NLL migration mode (which is the default with edition=2018) to inspect all parents of a closure in addition to the closure itself when looking to see if AST-borrowck issues an error for the given code.
This should be a candidate for beta backport.
Fixrust-lang#55492
Consider the following (play):
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
.The text was updated successfully, but these errors were encountered: