Open
Description
#[derive(Debug)]
struct ImportantExcerpt<'a> {
part: &'a str,
}
fn main() {
let mut root = ImportantExcerpt {part: "abc"};
{
let novel = String::from("Call me Ishmael. Some years ago...");
let first_sentence = novel.split('.').next().expect("Could not find a '.'");
root = ImportantExcerpt {part: first_sentence};
root.part = "1234"; // bind to new static str
}
println!("{:?}", root); // error does not live long enough
}