Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Created July 12, 2022 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/29ceed605b4e09d744e9d9879b4c3b85 to your computer and use it in GitHub Desktop.
Save hkulekci/29ceed605b4e09d744e9d9879b4c3b85 to your computer and use it in GitHub Desktop.
What is the mean of "value borrowed here after move"
pub fn run() {
// Correct One
let hello1 = "Hello";
let mut hello2 = String::from("Hello");
hello2.push('\u{1f600}');
println!("{}", hello1.len());
println!("{}", hello2.len());
println!("{:?}", (hello1, hello2));
}
pub fn run() {
// Wrong One
let hello1 = "Hello";
let mut hello2 = String::from("Hello");
println!("{:?}", (hello1, hello2));
hello2.push('\u{1f600}');
println!("{}", hello1.len());
println!("{}", hello2.len());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment