News for hackers. Stuff that matters.
Re:Rusty Ownership and the Lifecycle’s Stone by timakro on Sunday November 27, 2022 @12:29PM (#33764709)
Small correction: contrary to what the post claims this does not compile:

    fn main() {
        let s = String::from("hello");
        foo(s);
        println!("{}", s);
    }

    fn foo(le_string: String) -> String {
        println!("{}", le_string);
        le_string
    }
This does, which is probably what the author meant:

    fn main() {
        let s = String::from("hello");
        let s = foo(s);
        println!("{}", s);
    }

    fn foo(le_string: String) -> String {
        println!("{}", le_string);
        le_string
    }
Great post!
Re:Rusty Ownership and the Lifecycle’s Stone by kapolos on Sunday November 27, 2022 @12:37PM (#33764781)
Indeed, thank you for catching it! I will make an update.

Thanks again!