You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When borrowing an owned value, the lifetime of the value should be extended at least to the end of the current statement, and perhaps extended to the full lifetime of the borrow.
Extending the lifetime to the end of the current statement would allow constructs like the following to work:
foo(vec::from_elem(16, 0).slice(0,4));
Extending the lifetime to the full lifetime of the borrow would just be a bit more convenient for the programmer who doesn't care about having an owned pointer, although it may not be worth the complexity.