Created
September 24, 2021 13:06
-
-
Save mariot/1c9d9e76162957868afffdd11fa4ae39 to your computer and use it in GitHub Desktop.
Erreurs d'ownership
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ cargo run | |
| Compiling ownership v0.1.0 (file:///projects/ownership) | |
| error[E0382]: borrow of moved value: `s1` | |
| --> src/main.rs:5:28 | |
| | | |
| 2 | let s1 = String::from("hello"); | |
| | -- move occurs because `s1` has type `String`, which does not implement the `Copy` trait | |
| 3 | let s2 = s1; | |
| | -- value moved here | |
| 4 | | |
| 5 | println!("{}, world!", s1); | |
| | ^^ value borrowed here after move | |
| error: aborting due to previous error | |
| For more information about this error, try `rustc --explain E0382`. | |
| error: could not compile `ownership` | |
| To learn more, run the command again with --verbose. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment