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
I’ve read the code a few times and I don’t quite understand how the closure panicking could cause undefined behaviour. As far as I can tell, f is only ever called in “tail position”, after all the initialisation is done, even in with_slow. The TLSSlot passes it a pointer to the storage, wraps the result in Some and returns. There is no transient state that has to be cleaned up after it returns. There are no variables in scope with a Drop implementation in either with or with_slow. When you unwind it, it’s pretty much identical to having returned normally. How does it cause UB?
The text was updated successfully, but these errors were encountered:
I’ve read the code a few times and I don’t quite understand how the closure panicking could cause undefined behaviour. As far as I can tell,
f
is only ever called in “tail position”, after all the initialisation is done, even inwith_slow
. The TLSSlot passes it a pointer to the storage, wraps the result in Some and returns. There is no transient state that has to be cleaned up after it returns. There are no variables in scope with a Drop implementation in either with or with_slow. When you unwind it, it’s pretty much identical to having returned normally. How does it cause UB?The text was updated successfully, but these errors were encountered: