Skip to content

c-variadic: tweak std docs#155613

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:c-variadic-doc-tweaks
Apr 22, 2026
Merged

c-variadic: tweak std docs#155613
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:c-variadic-doc-tweaks

Conversation

@folkertdev
Copy link
Copy Markdown
Contributor

tracking issue: #44930

In preparation of a rename of arg to next_arg

cc @workingjubilee
r? tgross35

@folkertdev folkertdev added the F-c_variadic `#![feature(c_variadic)]` label Apr 21, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 21, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

Comment thread library/core/src/ffi/va_list.rs Outdated
///
/// When C passes variable arguments, integers smaller than [`c_int`] and floats smaller
/// than [`c_double`] are implicitly promoted to [`c_int`] and [`c_double`] respectively.
/// Implementing this trait for types that are subject to this promotion rule is invalid.
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit while you're here, "integers smaller than [c_int] and floats smaller than [c_double] are implicitly promoted to [c_int] and [c_double] respectively" could probably be rephrased to "integers smaller than [c_int] are promoted to [c_int], and [c_float] is promoted to [c_double]. Since not all floats smaller than double are promoted.

View changes since the review

Comment thread library/core/src/ffi/va_list.rs Outdated
/// The standard library implements this trait for primitive types that are
/// expected to have a variable argument application-binary interface (ABI) on all
/// platforms.
/// Support for other types is not portable.
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps something like "Support for other c_ types is not portable and may not be available on all platforms." to account for platforms where you might get c_float in the list? Or maybe mention specifically that u* and i* shouldn't be relied upon directly even though they may happen to get the trait impl on some platforms.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked it a bit more. The thing is that practically you can rely on e.g. usize having an implementation. It's really only in very niche cases that f32 is implemented, and the future i128 impl is very much non-portable.

but given that VaList is specifically for FFI, it feels OK to just recommend people use c_ types.

@folkertdev folkertdev force-pushed the c-variadic-doc-tweaks branch from 838e305 to 2c06c62 Compare April 21, 2026 20:03
@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the c-variadic-doc-tweaks branch from 2c06c62 to 6ca836b Compare April 21, 2026 20:44
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks

@bors r+ rollup

View changes since this review

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

📌 Commit 6ca836b has been approved by tgross35

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 22, 2026
…r=tgross35

c-variadic: tweak `std` docs

tracking issue: rust-lang#44930

In preparation of a rename of `arg` to `next_arg`

cc @workingjubilee
r? tgross35
rust-bors Bot pushed a commit that referenced this pull request Apr 22, 2026
Rollup of 7 pull requests

Successful merges:

 - #155589 (Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests)
 - #155610 (Add missing `dyn` keyword to `trait_alias` page of the Unstable Book)
 - #155615 (test cleanups for `ui/derives` and `ui/deriving`)
 - #154874 (Fix ICE for inherited const conditions on const closures)
 - #155605 (std: Update support for `wasm32-wasip3`)
 - #155613 (c-variadic: tweak `std` docs)
 - #155619 (Remove a bunch of unnecessary explicit lifetimes from the ast validator)
@rust-bors rust-bors Bot merged commit 48f36ed into rust-lang:main Apr 22, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 22, 2026
rust-timer added a commit that referenced this pull request Apr 22, 2026
Rollup merge of #155613 - folkertdev:c-variadic-doc-tweaks, r=tgross35

c-variadic: tweak `std` docs

tracking issue: #44930

In preparation of a rename of `arg` to `next_arg`

cc @workingjubilee
r? tgross35
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 22, 2026
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155589 (Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests)
 - rust-lang/rust#155610 (Add missing `dyn` keyword to `trait_alias` page of the Unstable Book)
 - rust-lang/rust#155615 (test cleanups for `ui/derives` and `ui/deriving`)
 - rust-lang/rust#154874 (Fix ICE for inherited const conditions on const closures)
 - rust-lang/rust#155605 (std: Update support for `wasm32-wasip3`)
 - rust-lang/rust#155613 (c-variadic: tweak `std` docs)
 - rust-lang/rust#155619 (Remove a bunch of unnecessary explicit lifetimes from the ast validator)
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)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants