Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

transpile: emit `VaList::next_arg` instead of `arg` for edition 2024

Open Beginner friendly
#2,033 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 7 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, rust

Research direction

Start in c2rust-transpile/src/translator/variadic.rs around line 238, where mk().ident("arg") is emitted for va_arg, and compare it with mk_va_list_ty and mk_va_list_copy, which already branch on edition. The pinned Edition2024 toolchain is in c2rust-rust-tools/src/lib.rs. Done means edition 2024 output emits next_arg, the pin is moved to a nightly that has the rename, and the generated va_arg example passes cargo check.

Written by the indexing model from the issue text.

Description

rust-lang/rust#155614 renamed VaList::arg to VaList::next_arg, in nightlies from 2026-04-24 on. c2rust still emits .arg::<T>() for va_arg in every edition, so --edition 2024 output for a function that uses va_arg only builds on nightlies before that date.

c2rust-transpile/src/translator/variadic.rs (line 238 on master a9bcc81) emits mk().ident("arg") unconditionally, while mk_va_list_ty and mk_va_list_copy in the same file already switch on the edition. The Edition2024 toolchain is pinned to nightly-2026-03-03 in c2rust-rust-tools/src/lib.rs, which predates the rename, so nothing in the tree notices.

Repro
#include <stdarg.h>

int sum(int n, ...) {
    va_list ap;
    va_start(ap, n);
    int s = 0;
    while (n--) s += va_arg(ap, int);
    va_end(ap);
    return s;
}
c2rust transpile --edition 2024 compile_commands.json --emit-build-files -o out

This emits:

    let mut ap: ::core::ffi::VaList;
    ap = c2rust_args.clone();
    ...
        s += ap.arg::<::core::ffi::c_int>();

cargo check on the output passes with the pinned nightly-2026-03-03. With nightly-2026-05-11 and nightly-2026-08-02 it fails:

error[E0599]: no method named `arg` found for struct `VaList<'a>` in the current scope
  --> src/va.rs:25:17
   |
25 |         s += ap.arg::<::core::ffi::c_int>();
   |                 ^^^ method not found in `VaList<'_>`

Tested with c2rust built from f19c646. The code is unchanged on master.

Suggestion

For Edition2024, emit next_arg and move the pinned toolchain to nightly-2026-04-24 or later. c_variadic was stabilized in rust-lang/rust#155697 (merged 2026-07-22), so with a toolchain from after that, the #![feature(c_variadic)] attribute can go too.

Context: Tractor-Crisp builds c2rust's edition-2021 output on nightly-2026-08-02 and now rewrites .arg::< to .next_arg::< after transpiling (GaloisInc/Tractor-Crisp#211).

Dominant language
Rust
Stars
4.8k
Forks
318
Avg merge
7d 13h
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from immunant/c2rust

All issues in immunant/c2rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.