I recently in study Rust,But stop in lifetime.anyone can help me? I'm trying to Make a string literal with static lifetime,but When it goes out of scope, the reference can no longer be used.
fn main(){
{
let s: &'static str = "hello world";
}
println("s={}",s);
}
I got an error: s not found in this scope I'm trying to use static keyword
fn main(){
{
static s: &'static str = "hello world";
}
println("s={}",s);
}
still the same. It any diffent between static keyword,static lifetime and scope? Thanks!