transpile: emit `VaList::next_arg` instead of `arg` for edition 2024
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
- Domain
- build-system, compilers
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from immunant/c2rust
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
immunant/c2rust#621 · 2 comments · 1 reaction ·
Maintainers usually reply within 7 days
-
reorganize_definitions breaks SQLite when the CLI shell and its extensions are includedPossibly taken @thedataking claimed this 6 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Maintainers usually reply within 7 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 7 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
longbridge/gpui-kit#3620 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
mongodb/kingfisher#564 ·
Maintainers usually reply within 1 day
-
bug qq-feedback
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
corro-client drops the last byte of a response line that has no trailing newlinePossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
proxy: include denial_category in the "proxy request denied" log linePossibly taken @sreyas-endor claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
nolabs-ai/nono#2172 · 1 comment ·
Maintainers usually reply within 1 day