-
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.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.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
It would be nice if the following error message
test.rs:7:9: 7:13 error: cannot move out of dereference of `&`-pointer
test.rs:7 self.option.map(|x| x)
^~~~
error: aborting due to previous error
would give a hint why exactly something was moved in the following code
struct Type {
option: Option<Vec<u8>>
}
impl Type {
fn method(&self) -> Option<Vec<u8>> {
self.option.map(|x| x)
}
}
fn main() {
let _ = Type { option: None }.method();
}
Ideally "map takes option by value" or something like that.
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.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.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics