Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•error•[E0106]: missing lifetime specifier --> src/main.rs:5:16 | 5 | fn dangle() -> &String { | ^ expected named lifetime parameter

fn no_dangle() -> String {
    let s = String::from("hello");

    s
}
This works without any problems. Ownership is moved out, and nothing is deallocated.
 
PREVIOUS NEXT
Tagged: #missing #lifetime #specifier #fn #expected #named #lifetime #parameter
ADD COMMENT
Topic
Name
2+2 =