mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() implement checks for tail calls Quoting the [RFC draft](https://github.com/phi-go/rfcs/blob/guaranteed-tco/text/0000-explicit-tail-calls.md): > The argument to become is a function (or method) call, that exactly matches the function signature and calling convention of the callee. The intent is to ensure a matching ABI. Note that lifetimes may differ as long as they pass borrow checking, see [below](https://github.com/phi-go/rfcs/blob/guaranteed-tco/text/0000-explicit-tail-calls.md#return-type-coercion) for specifics on the return type. > Tail calling closures and tail calling from closures is not allowed. This is due to the high implementation effort, see below, this restriction can be lifted by a future RFC. > Invocations of operators were considered as valid targets but were rejected on grounds of being too error-prone. In any case, these can still be called as methods. > Tail calling [variadic functions](https://doc.rust-lang.org/beta/unstable-book/language-features/c-variadic.html) and tail calling from variadic functions is not allowed. As support for variadic function is stabilized on a per target level, support for tail-calls regarding variadic functions would need to follow a similar approach. To avoid this complexity and to minimize implementation effort for backends, this interaction is currently not allowed but support can be added with a future RFC. ----- The checks are implemented as a query, similarly to `check_unsafety`. The code is cherry-picked straight out of #112657 which was written more than a year ago, so I expect we might need to change some things ^^" |
||
---|---|---|
.. | ||
become-macro.rs | ||
become-operator.fixed | ||
become-operator.rs | ||
become-operator.stderr | ||
become-outside.array.stderr | ||
become-outside.constant.stderr | ||
become-outside.rs | ||
become-uncallable.fixed | ||
become-uncallable.rs | ||
become-uncallable.stderr | ||
closure.fixed | ||
closure.rs | ||
closure.stderr | ||
constck.rs | ||
constck.stderr | ||
ctfe-arg-bad-borrow.rs | ||
ctfe-arg-bad-borrow.stderr | ||
ctfe-arg-good-borrow.rs | ||
ctfe-arg-move.rs | ||
ctfe-collatz-multi-rec.rs | ||
ctfe-id-unlimited.return.stderr | ||
ctfe-id-unlimited.rs | ||
ctfe-tail-call-panic.rs | ||
ctfe-tail-call-panic.stderr | ||
drop-order.rs | ||
in-closure.rs | ||
in-closure.stderr | ||
return-lifetime-sub.rs | ||
return-mismatches.rs | ||
return-mismatches.stderr | ||
signature-mismatch.rs | ||
signature-mismatch.stderr | ||
unsafeck.rs | ||
unsafeck.stderr |