Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
61e2fb3
add `GlobalAlloc::VaList`
folkertdev Jan 2, 2026
6b7f675
allow `const fn` to be c-variadic
folkertdev Jan 2, 2026
335c8ef
make `Va::arg` and `VaList::drop` `const fn`s
folkertdev Jan 2, 2026
81b534d
on call, split the standard and c-variadic arguments
folkertdev Jan 2, 2026
790a67a
set up `VaList` global storage
folkertdev Jan 2, 2026
52a64b7
implement `va_arg` in `rustc_const_eval`
folkertdev Jan 2, 2026
b8a24d6
basic support for `AllocKind::VaList` in miri
folkertdev Jan 2, 2026
9d64415
add c-variadic const eval test
folkertdev Jan 2, 2026
8618f25
basic `va_copy` implementation
folkertdev Jan 7, 2026
6d1c529
move over to the shared interpreter
folkertdev Jan 8, 2026
2acc721
more copy UB tests
folkertdev Jan 20, 2026
3dfaced
stop using `reserve_and_set_va_list_alloc`
folkertdev Jan 22, 2026
0e78a06
make `va_list_map` private
folkertdev Jan 22, 2026
8266cc1
remove `GlobalAlloc::VaList` again
folkertdev Jan 22, 2026
1c801db
add (dead) allocation bookkeeping
folkertdev Jan 22, 2026
04721bc
zero the `VaList` place so it is initialized
folkertdev Jan 22, 2026
83a12af
add c-variadic miri test
folkertdev Jan 22, 2026
b4a6323
WIP
folkertdev Jan 22, 2026
99b7ec2
move va_list operations into `InterpCx`
folkertdev Jan 23, 2026
b74771f
`fn addr_from_alloc_id_uncached`: make va_list emit a dummy_alloc
folkertdev Jan 24, 2026
4d68068
use places smarter
folkertdev Jan 24, 2026
ba84fa4
move things around
folkertdev Jan 24, 2026
2594aea
fix formatting
folkertdev Jan 24, 2026
40ef87c
rename to `self.va_list_ptr`
folkertdev Jan 24, 2026
b1c39ec
add more miri tests
folkertdev Jan 24, 2026
342025b
Apply suggestion from @RalfJung
folkertdev Jan 25, 2026
ee17907
low-hanging fruit after review
folkertdev Jan 25, 2026
72ced42
consider the caller location argument
folkertdev Jan 25, 2026
930527c
use `transmute_copy`
folkertdev Jan 25, 2026
6ac782e
split out `allocate_varargs`
folkertdev Jan 25, 2026
0fa0719
report UB when caller and callee signatures do not match
folkertdev Jan 28, 2026
ed90238
retrieve key field without the lang item
folkertdev Jan 28, 2026
6d830c3
feature-gate c-variadic definitions and calls in const contexts
folkertdev Jan 28, 2026
75e66bb
clean up feature gate
folkertdev Jan 29, 2026
74ed893
update tests
folkertdev Jan 29, 2026
34683db
use vecdeque
folkertdev Jan 29, 2026
49a5967
changes after code review
folkertdev Jan 31, 2026
6db8088
Update compiler/rustc_const_eval/src/interpret/call.rs
folkertdev Feb 8, 2026
bb063e1
Update compiler/rustc_const_eval/src/interpret/stack.rs
folkertdev Feb 8, 2026
13f1178
Update compiler/rustc_const_eval/src/interpret/stack.rs
folkertdev Feb 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,13 +698,11 @@ impl<'a> AstValidator<'a> {
unreachable!("C variable argument list cannot be used in closures")
};

// C-variadics are not yet implemented in const evaluation.
if let Const::Yes(const_span) = sig.header.constness {
self.dcx().emit_err(errors::ConstAndCVariadic {
spans: vec![const_span, variadic_param.span],
const_span,
variadic_span: variadic_param.span,
});
if let Const::Yes(_) = sig.header.constness
&& !self.features.enabled(sym::const_c_variadic)
{
let msg = format!("c-variadic const function definitions are unstable");
feature_err(&self.sess, sym::const_c_variadic, sig.span, msg).emit();
}

if let Some(coroutine_kind) = sig.header.coroutine_kind {
Expand Down
11 changes: 0 additions & 11 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,17 +823,6 @@ pub(crate) struct ConstAndCoroutine {
pub coroutine_kind: &'static str,
}

#[derive(Diagnostic)]
#[diag("functions cannot be both `const` and C-variadic")]
pub(crate) struct ConstAndCVariadic {
#[primary_span]
pub spans: Vec<Span>,
#[label("`const` because of this")]
pub const_span: Span,
#[label("C-variadic because of this")]
pub variadic_span: Span,
}

#[derive(Diagnostic)]
#[diag("functions cannot be both `{$coroutine_kind}` and C-variadic")]
pub(crate) struct CoroutineAndCVariadic {
Expand Down
Loading
Loading