reference
reference copied to clipboard
Clarify warning regarding changes of rules for temporary lifetime extension
The subsection on temporary lifetime extension currently contains the following warning:
Note: The exact rules for temporary lifetime extension are subject to change. This is describing the current behavior only.
It is not clear under which conditions these rules may change. A new compiler version? A new edition? Without clarification, this might be understood as a discouragement to rely on temporary lifetime extension in productive code. Is that intended?
Link to the respective subsection: https://doc.rust-lang.org/reference/destructors.html#temporary-lifetime-extension
One thing I'd like to add, it should potentially keep a discouraging message at least for certain contexts. For example, I would assume that it's a bad idea to rely on the current behavior of lifetime extensions to keep unsafe
sections sound. Maybe something along "You need to ensure values your unsafe code relies on have a proper non-temporary location".