Open
Description
I think the answer to this is fairly obvious, but I couldn't see it stated anywhere. Is it the case that lifetimes are only relevant for determining whether code is safe and not whether it is valid? In other words, lifetimes (or incorrect lifetimes) can never cause UB by themselves.
Furthermore, the compiler can never optimise something based on eg. the knowledge that a reference has 'static
lifetime, and transmuting between different lifetimes is always OK as long as the stacked borrows rules are followed at runtime.