Description
While investigating #52979, I noticed some of the diagnostics from --edition 2018
are different than what either of the test.stderr
and test.nll.stderr
would lead one to expect to see.
This appears to arise from the implementation of -Z borrowck=migrate
, from what I can tell.
For example, on ui/borrowck/borrowck-in-static.rs, we have from AST-borrowck:
rust/src/test/ui/borrowck/borrowck-in-static.stderr
Lines 1 to 9 in 40cb447
and from NLL we have:
rust/src/test/ui/borrowck/borrowck-in-static.nll.stderr
Lines 1 to 7 in 40cb447
but I am seeing this from -Z borrowck=migrate
:
error[E0507]: cannot move out of captured variable in an `Fn` closure
--> ../src/test/ui/borrowck/borrowck-in-static.rs:15:17
|
15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^ cannot move out of captured variable in an `Fn` closure
error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
--> ../src/test/ui/borrowck/borrowck-in-static.rs:15:17
|
15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^
| |
| cannot move out of `x`, as it is a captured variable in a `Fn` closure
| cannot move
|
help: consider changing this to accept closures that implement `FnMut`
--> ../src/test/ui/borrowck/borrowck-in-static.rs:15:14
|
15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^^^^
error: aborting due to 2 previous errors
My guess that this is arising because I must have missed at least one case where AST-borrowck signals an error. Thus, when the -Z borrowck=migrate
runs the AST-borrowck as a fallback in response to an error encounters during the MIR-borrowck, the user can sometimes see the both sets the errors from both NLL and AST-borrowck.