4 ms·
Then maybe rustc ought to have diagnostics that warn if a recursive function won't be optimized fully, and then I can either avoid recursion or rewrite to fit i
by cm3 11y ago
Then maybe rustc ought to have diagnostics that warn if a recursive function won't be optimized fully, and then I can either avoid recursion or rewrite to fit into the optimizer, but having to appease a changing optimizer isn't what I'd call maintainable code, so a function attribute might make more sense.
- geofft 11y agoThere's a reserved and unimplemented keyword "become", which is like "return" except it requires that it can optimize the tail call (and is a compile-time error if it can't). See this comment: https://github.com/rust-lang/rfcs/issues/271#issuecomment-189386398 https://github.com/rust-lang/rfcs/issues/271#issuecomment-18... Nobody's tried implementing it recently, though.