You cannot move a value out of a borrowed reference because the borrow only grants temporary access, not ownership. To fix this, clone the value if it implements Clone, or change the function signature to take ownership instead of a reference.
// Option 1: Clone the value (if it implements Clone)
let s = String::from("hello");
let s2 = s.clone(); // Creates a new copy
// Option 2: Take ownership instead of borrowing
fn takes_ownership(s: String) { // Changed from &String to String
println!("{s}");
}