-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Consider this example:
struct Test(u64, u64);
impl Test {
fn into_tuple(self) -> (u64, u64) {
(self.0, self.1)
}
}
fn main() {
let x = vec![Test(1,1), Test(1,2)];
let _tuples = x.iter().map(|test| test.clone().into_tuple()).collect::<Vec<_>>();
}
struct Test
is not implementing Clone
trait, but here is the error message:
Compiling playground v0.0.1 (file:///playground)
error[E0507]: cannot move out of borrowed content
--> src/main.rs:12:39
|
12 | let _tuples = x.iter().map(|test| test.clone().into_tuple()).collect::<Vec<_>>();
| ^^^^^^^^^^^^ cannot move out of borrowed content
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.