-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NLL elides type behind a borrow (and its Copy
-ness) when reporting move error
#51190
Comments
Copy
-ness) when reporting move error
Hmm, interesting; it seems like the MIR dataflow is at least making an attempt to capture the relevant distinctions here, at least based on the code at the following links: rust/src/librustc_mir/dataflow/move_paths/builder.rs Lines 148 to 156 in 2b5aa90
rust/src/librustc_mir/borrow_check/mod.rs Lines 141 to 143 in 2b5aa90
So... is that we never actually construct instances of such errors when doing dataflow for MIR-borrowck? (Or is there some deeper issue with the error reporting?) I will look a bit further into this now. |
I think I have this figured out. I hope to have a PR up later today. |
…bout why the move wasn't a copy. This should address rust-lang#51190.
…ved-from-behind-borrow, r=nikomatsakis NLL: report type moved from behind borrow of array/slice When NLL has illegal move due to borrowed content in an array or slice, provide feedback about why the move wasn't a copy. Drive by: While comparing the resulting `.nll.stderr` files to their old borrowck variants, I noticed that the test for borrowck-vec-pattern-nesting.rs was not signaling some errors under NLL due to the test assuming lexical lifetimes. So I fixed that too. Fix rust-lang#51190
…bout why the move wasn't a copy. This should address rust-lang#51190.
…ved-from-behind-borrow, r=nikomatsakis NLL: report type moved from behind borrow of array/slice When NLL has illegal move due to borrowed content in an array or slice, provide feedback about why the move wasn't a copy. Drive by: While comparing the resulting `.nll.stderr` files to their old borrowck variants, I noticed that the test for borrowck-vec-pattern-nesting.rs was not signaling some errors under NLL due to the test assuming lexical lifetimes. So I fixed that too. Fix rust-lang#51190
…hind-borrow, r=nikomatsakis NLL: report type moved from behind borrow of array/slice When NLL has illegal move due to borrowed content in an array or slice, provide feedback about why the move wasn't a copy. Drive by: While comparing the resulting `.nll.stderr` files to their old borrowck variants, I noticed that the test for borrowck-vec-pattern-nesting.rs was not signaling some errors under NLL due to the test assuming lexical lifetimes. So I fixed that too. Fix #51190
…hind-borrow, r=nikomatsakis NLL: report type moved from behind borrow of array/slice When NLL has illegal move due to borrowed content in an array or slice, provide feedback about why the move wasn't a copy. Drive by: While comparing the resulting `.nll.stderr` files to their old borrowck variants, I noticed that the test for borrowck-vec-pattern-nesting.rs was not signaling some errors under NLL due to the test assuming lexical lifetimes. So I fixed that too. Fix #51190
If you look at the AST-borrowck output for a case like borrowck-vec-pattern-nesting.rs, you see output like this:
rust/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
Line 19 in 20af72b
but NLL only reports this:
rust/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
Line 19 in 20af72b
It is probably useful to include the type behind the borrow (and the fact that it is non-copy) when that is relevant to the move being attempted.
The text was updated successfully, but these errors were encountered: