-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
explicit_tail_calls: cannot become a function that never returns #150243
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-explicit_tail_calls`#![feature(explicit_tail_calls)]``#![feature(explicit_tail_calls)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#![feature(explicit_tail_calls)]
fn foo() -> u64 {
become std::process::abort()
}currently says
error[E0308]: mismatched types
--> src/lib.rs:4:5
|
4 | become std::process::abort()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `!`
|
= note: expected type `u64`
found type `!`
While the RFC does require that the types match, ! sounds like it ought to be an exception to this rule: not returning at all is a perfectly valid thing to want to do when tail-calling and should not require any special handling other than in the type checking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-explicit_tail_calls`#![feature(explicit_tail_calls)]``#![feature(explicit_tail_calls)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.