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
My feeling is that the loop form should be valid, since the thing object is erased, and so the thing and next borrows do not overlap or alias (that is, the old object to which thing pointed is inaccessible). However I could easily be wrong.
Allowing the first would allow us to write code that is guaranteed to be efficient; although LLVM does perform TCO often so it isn't completely necessary. (That said, LLVM doesn't TCO each_rec, the closure seems to be interfering: with the closure call it is still recursive, but with just thing.x += 1 it is optimised to a loop)
(The equivalent thing with & instead of &mut is already valid.)
The text was updated successfully, but these errors were encountered:
each_loop
is invalid, buteach_rec
is ok.My feeling is that the loop form should be valid, since the
thing
object is erased, and so thething
andnext
borrows do not overlap or alias (that is, the old object to whichthing
pointed is inaccessible). However I could easily be wrong.Allowing the first would allow us to write code that is guaranteed to be efficient; although LLVM does perform TCO often so it isn't completely necessary. (That said, LLVM doesn't TCO
each_rec
, the closure seems to be interfering: with the closure call it is still recursive, but with justthing.x += 1
it is optimised to a loop)(The equivalent thing with
&
instead of&mut
is already valid.)The text was updated successfully, but these errors were encountered: