-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Unnecessary 'cannot bind by-move with sub-bindings' with bindings_after_at #69971
Copy link
Copy link
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.F-bindings_after_at`#![feature(bindings_after_at)]``#![feature(bindings_after_at)]`T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.F-bindings_after_at`#![feature(bindings_after_at)]``#![feature(bindings_after_at)]`T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following code (playground link) attempts to move a struct while using a sub-binding to copy one of its fields:
On nightly, it produces two errors:
However, it would be sound to allow this, since it's equivalent to copying the field before or after moving the struct.
(There are no errors if the struct does implement
Copy.)