-
Notifications
You must be signed in to change notification settings - Fork 13.8k
document core::ffi::VaArgSafe
#146521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
document core::ffi::VaArgSafe
#146521
+132
−6
Conversation
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
and document `VaList::arg`.
as far as I can see this was not tested, though the error message was already implemented
…unctions they don't do anything, because LLVM is unable to inline c-variadic functions (on most targets, anyway)
|
Thanks! I think I will go ahead and shove this into the queue since this is an already discussed, docs-and-tests-only change. @bors r+ rollup |
bors
added a commit
that referenced
this pull request
Sep 13, 2025
Rollup of 8 pull requests Successful merges: - #113095 (Document `become` keyword) - #146159 (Some hygiene doc improvements) - #146171 (tidy: check that error messages don't start with a capitalized letter) - #146419 (Update the arm-* and aarch64-* platform docs.) - #146473 (Revert "Constify SystemTime methods") - #146506 (Fix small typo in check-cfg.md) - #146517 (fix Condvar::wait_timeout docs) - #146521 (document `core::ffi::VaArgSafe`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Sep 14, 2025
Rollup merge of #146521 - folkertdev:document-va-arg-safe, r=workingjubilee document `core::ffi::VaArgSafe` tracking issue: #44930 A modification of #146454, keeping just the documentation changes, but not unsealing the trait. Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the `va_arg` implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types. This PR also adds some various other tests for edge cases of c-variadic: - the `#[inline]` attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted. `#[rustc_force_inline]` already rejects c-variadic functions. - naked functions should accept and work with a C variable argument list. In the future we'd like to allow more ABIs with naked functions (basically, any ABI for which we accept defining foreign c-variadic functions), but for now only `"C"` and `"C-unwind` are supported - guaranteed tail calls: c-variadic functions cannot be tail-called. That was already rejected, but there was not test for it. r? `@workingjubilee`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
F-c_variadic
`#![feature(c_variadic)]`
F-explicit_tail_calls
`#![feature(explicit_tail_calls)]`
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
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.
tracking issue: #44930
A modification of #146454, keeping just the documentation changes, but not unsealing the trait.
Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the
va_arg
implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types.This PR also adds some various other tests for edge cases of c-variadic:
#[inline]
attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted.#[rustc_force_inline]
already rejects c-variadic functions."C"
and"C-unwind
are supportedr? @workingjubilee