Skip to content

Instantly share code, notes, and snippets.

@CodeSandwich
Created March 26, 2018 12:39
Show Gist options
  • Save CodeSandwich/a92a81bb924cc81b259629788a7a01d1 to your computer and use it in GitHub Desktop.
Save CodeSandwich/a92a81bb924cc81b259629788a7a01d1 to your computer and use it in GitHub Desktop.
fn value_moved_during_borrow_lifetime() {
let value = "abc".to_string(); // crate value
let borrow = &value; // create borrow
let my_box = Box::new(value); // <COMPILE TIME FAIL> move of value
// while borrowed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment