Do proper signature equality checking for tail calls#156007
Open
WaffleLapkin wants to merge 4 commits intorust-lang:mainfrom
Open
Do proper signature equality checking for tail calls#156007WaffleLapkin wants to merge 4 commits intorust-lang:mainfrom
WaffleLapkin wants to merge 4 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
folkertdev
reviewed
Apr 30, 2026
| become foo(x, y); | ||
| //~^ ERROR mismatched signatures | ||
| //[current]~^ ERROR mismatched signatures | ||
| } |
Contributor
There was a problem hiding this comment.
Member
Author
There was a problem hiding this comment.
I'm not quite sure (lcnr can probably explain better), but something something opaque types are more annoying to handle in the old solver and in this case they are not being revealed as their hidden type.
3371ceb to
0ef36d2
Compare
36 tasks
This comment has been minimized.
This comment has been minimized.
15bd832 to
1ce7add
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For tail calls to be valid, we need some support from the ABI, specifically the caller of the function needs to be able to do all necessary cleanup after the tail called function returns. This can be achieved with a callee-cleanup ABI, but we want to permit tail calls for other ABIs as well (in particular,
extern "rust").In such cases the property that we are looking for is "the caller and callee require the same cleanup". We approximate this with "caller and callee have the same ABI" and we approximate that with "caller and callee have the same signatures (modulo subtyping)".
Previously the code would compare
FnSigs with==, which would not support subtyping and produced other weird results. This PR changes tail call checks to use type checking machinery and in particulareq.It also fixes handling of opaque types, given the next trait solver is enabled.
r? types