Re:A half-hour to learn Rust
by GolDDranks on Saturday January 02, 2021 @02:08PM
(#25615424)
> a can live up to the end of the application. &a can live up to the end of the application.
Nope, a reference to a stack frame can't live up to the end of the application. The stack frame gets deallocated and the referent ceases to exist; therefore the reference you're creating in your linked example doesn't outlive 'static. `main` is not an exception to this in Rust.
Nope, a reference to a stack frame can't live up to the end of the application. The stack frame gets deallocated and the referent ceases to exist; therefore the reference you're creating in your linked example doesn't outlive 'static. `main` is not an exception to this in Rust.