Skip to content
Quiz · Borrowing · lesson 6 of 11

Quiz — two borrows

Question 1 of 2

What happens when this program is built and run?

Rust
fn main() {
    let mut s = String::from("hi");
    let r1 = &mut s;
    let r2 = &mut s;
    r1.push('!');
    r2.push('?');
    println!("{s}");
}