-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Technically, it's possible for std to change any type to have an additional parameter with default being a type with lifetime parameter set to 'static. This is technically possible with any type, though doing it for arrays and such would require new syntax ([T; N]<X>?).
However, practically, this is very unlikely to happen. Still I'm calling it out in case you want to do something about it. I think that collections are closest to this happening because of the default allocator. If the global allocator ever becomes Whatever<'static> this crate will become unsound. Primitive types are probably the least likely.
Maybe it'd be best to try getting this into core. I've seen some discussion about allowing more casts, so maybe it'd be appealing especially if coupled with a derive macro that can check the type signature and implement the trait. (Should be really simple: if a type contains lifetime parameters emit an error pointing at them, if it doesn't take all type parameters T1...Tn and emit unsafe impl<T1: LifetimFree, T2: LifetimFree, T3: LifetimFree, ..., Tn: LifetimFree> LifetimFree for Foo {}).