rust-lang / rust-lang/rust

Tracking issue for release notes of #155697: Stabilize c-variadic function definitions

Open Beginner friendly
#158,803 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-run-make F-c_variadic F-explicit_tail_calls release-blog-post relnotes relnotes-tracking-issue T-compiler T-lang T-libs T-opsem
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This issue tracks the release notes text for #155697.

cc @folkertdev, @tgross35 -- original issue/PR authors and assignees for drafting text

See the forge.rust-lang.org chapter about release notes for an overview of how the release team makes use of these tracking issues.

Release notes text

This section should be edited to specify the correct category(s) for the change, with succinct description(s) of what changed. Some things worth considering:

  • Does this need an additional compat notes section?
  • Was this a libs stabilization that should have additional headers to list new APIs under Stabilized APIs and Const Stabilized APIs?
# Language
- [Stabilize C-variadic function definitions](https://github.com/rust-lang/rust/pull/155697)

[!TIP]
Use the previous releases for inspiration on how to write the release notes text and which categories to pick.

Release blog section

If this change is notable enough for inclusion in the blog post then this section should be edited to contain a draft for the blog post. Otherwise leave it empty.

Rust could already call c-variadic funtions like `libc::printf` which use a variable argument list `...` to accept an arbitrary number of arguments. Now Rust can also define such functions like so:

```rust
/// SAFETY: must be called with (at least) 2 i32 arguments.
unsafe extern "C" fn sum(mut args: ...) -> i32 {
    // SAFETY: guaranteed by the caller.
    let a = unsafe { args.next_arg::<i32>() };
    let b = unsafe { args.next_arg::<i32>() };
    a + b
}

fn foo() -> i32 {
    unsafe { sum(0i32, 2i32) }
}
```

The type of `...` is [`VaList`](https://doc.rust-lang.org/std/ffi/struct.VaList.html), which is ABI-compatible with the C `va_list` type across targets. What types can be read from a `VaList` is guarded by the [`VaArgSafe`](https://doc.rust-lang.org/std/ffi/struct.VaArgSafe.html) trait.

[!NOTE]

If a blog post section is required the release-blog-post label should be added (@rustbot label +release-blog-post) to this issue as otherwise it may be missed by the release team.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the forge release-notes chapter and compare the previous releases for category and wording conventions. Review Rust pull request #155697 and refine the Release notes text, including any compatibility or API sections that apply; decide whether a blog section is needed and add the release-blog-post label if so.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation, release
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.