Refactor FnDecl and FnSig non-type fields into a new wrapper type#155223
Draft
teor2345 wants to merge 2 commits intorust-lang:mainfrom
Draft
Refactor FnDecl and FnSig non-type fields into a new wrapper type#155223teor2345 wants to merge 2 commits intorust-lang:mainfrom
teor2345 wants to merge 2 commits intorust-lang:mainfrom
Conversation
bjorn3
reviewed
Apr 13, 2026
Comment on lines
+896
to
899
| let c_variadic_from = fn_args_kind_from.c_variadic(); | ||
| let c_variadic_to = fn_args_kind_to.c_variadic(); | ||
| assert_eq!( | ||
| c_variadic_from, c_variadic_to, |
Member
There was a problem hiding this comment.
Can this directly check equality for the FnArgsKind`?
Contributor
Author
There was a problem hiding this comment.
Can this directly check equality for the FnArgsKind`?
Yep, but then when we add more fields the error stops providing useful details.
I think it would be clearer to move more fields into the type in this PR, so I'll do that over the next week or so.
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.
This PR is part of an initial cleanup for the arg splat experiment, but it's a useful refactor by itself.
It refactors the non-type fields of
FnDecl,FnSig, andFnHeaderinto a new packed wrapper types, based on this comment:#153697 (comment)
It also refactors some common
FnSigcreation settings into their own methods. I did this instead of creating a struct with defaults. I wasn't sure how to do that, because we need the bit-packing to create space for the splatted argument index for thesplatexperiment.We need to pack the
FnDeclandFnSigvalues somehow, to avoid breaking "type is small" assertions for commonly used types whensplatgets added. This PR packs these types:unwindvariants (38) -> 6 bitsFor now, I just want to check CI passes:
r? ghost