Closed
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.