by steveklabnik · 11y ago · 0 comments
> That would leave 'ref' dangling, if even for a moment, like here. That'd be bad.
I'm not sure I agree that it would be bad (except maybe from a purity standpoint). Ref is unreachable during the time it is "pointing" to the out-of-scope "val", so nothing can actually reach the out-of-scope value through ref.
You can argue that it would be easier if it just made this work, but at the same time, there would be more special cases. Right now, the rule is very simple.
We'll see once SEME regions and or non-lexical borrows land, though...