4 ms·
No, not quite, the signature will be `fn foo<'a>() -> &'a u8` (there is no way to elide this) However, Rust lifetimes are stretchy-squeezy, and a free lifetime
by Manishearth 6y ago
No, not quite, the signature will be `fn foo<'a>() -> &'a u8` (there is no way to elide this)
However, Rust lifetimes are stretchy-squeezy, and a free lifetime is basically the same as 'static when it comes to covariant lifetimes, since both are "I can be whatever you want me to be".
However if the lifetime is invariant (e.g. in https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=33cfb6dfde60bb44e36a71b461e66724 https://play.rust-lang.org/?version=stable&mode=debug&editio...), it is actually not 'static and will map to whatever lifetime is requested by the context.
- brundolf 6y agoWibbly-wobbly timey-wimey? :)