Skip to content

Commit 85617f1

Browse files
authored
Rollup merge of rust-lang#97767 - RalfJung:variadic, r=davidtwco
interpret: do not claim UB until we looked more into variadic functions I am not actually sure if this is UB, and anyway for FFI shims, Miri currently does not attempt to distinguish between arguments passed via variadics vs directly. So let's be consistent. (Programs that ran into this error will anyway immediately fall through to the "unsupported" message on the next line.)
2 parents 6da214c + a6207ec commit 85617f1

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

compiler/rustc_const_eval/src/interpret/terminator.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
353353
// FIXME: for variadic support, do we have to somehow determine callee's extra_args?
354354
let callee_fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?;
355355

356-
if callee_fn_abi.c_variadic != caller_fn_abi.c_variadic {
357-
throw_ub_format!(
358-
"calling a c-variadic function via a non-variadic call site, or vice versa"
359-
);
360-
}
361-
if callee_fn_abi.c_variadic {
356+
if callee_fn_abi.c_variadic || caller_fn_abi.c_variadic {
362357
throw_unsup_format!("calling a c-variadic function is not supported");
363358
}
364359

0 commit comments

Comments
 (0)