Closed
Description
The following code emits "cannot move out of borrowed content" without any hint about the reason whatsoever. I think we should add a "help" pointing to the self
argument of talk
and stating something along the lines of "because of consuming argument here". If it's in the same crate, maybe even suggest to change it to a reference.
struct Sheep {
message: String
}
impl Sheep {
fn talk(self) {
println!("{}", self.message);
}
}
fn main()
{
let sheep = &Sheep { message: "Määh".into() };
sheep.talk();
}
Errors:
Compiling playground v0.0.1 (file:///playground)
error[E0507]: cannot move out of borrowed content
--> src/main.rs:14:5
|
14 | sheep.talk();
| ^^^^^ cannot move out of borrowed content
error: aborting due to previous error
For more information about this error, try `rustc --explain E0507`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.