Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unrelated to the above convo, but: An owned object can be bound by a static lifetime, for example. Eg, `fn foo<T: 'static>(t: T){}\n foo(String::new());`


More dangerous / less common, but you can also launder lifetimes through unsafe where you use ‘static to indicate “it’s not possible to verify lifetime at compile time but I promise you this will outlive you”. An example of this would be storing a reference that is reference counted but you don’t want the lifetime to bleed out into the type signature.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: