Re:Rust will likely not support tail call optimization
by pcwalton on Thursday April 11, 2013 @01:22AM
(#5530118)
Yeah, we discussed the possibility of doing this. But we eventually decided that it wasn't worth it due to these issues:
* It's surprising behavior for destructors, which can have side effects. C++/D RAII and try/finally in other languages never behave like this.
* You can do it yourself, by moving the values-to-be-destructed into the bit bucket with "let _ = ...";
* You still have the ABI issues in that you can't use cdecl and have to use Pascal/stdcall to get TCO.
Couldn't owned boxes (~) passed through the jump transfer their ownership to the next frame (so they'll be destructed by whoever finally does return), and everything else just get destructed before the jump?