Skip to content
Quiz · Borrowing · lesson 8 of 11

Quiz — returning &String

What happens when this program is built and run?

Rust
fn make() -> &String {
    let s = String::from("hi");
    &s
}

fn main() {
    let r = make();
    println!("{}", r.len());
}