about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-06-06 14:34:58 +0200
committerGitHub <noreply@github.com>2022-06-06 14:34:58 +0200
commit85617f1c9311efb39e5b8b68e6430a8a9ecbfd38 (patch)
tree1c064012fb4123685a6caa2e6efb5d3539f73a58
parent6da214c1e2a85b420eacec0dc36525aab586e823 (diff)
parenta6207ec975abeb6132aeeede0d3895dbe1d877a8 (diff)
downloadrust-85617f1c9311efb39e5b8b68e6430a8a9ecbfd38.tar.gz
rust-85617f1c9311efb39e5b8b68e6430a8a9ecbfd38.zip
Rollup merge of #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.)
-rw-r--r--compiler/rustc_const_eval/src/interpret/terminator.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs
index 10da2f803af..57d06b48ca4 100644
--- a/compiler/rustc_const_eval/src/interpret/terminator.rs
+++ b/compiler/rustc_const_eval/src/interpret/terminator.rs
@@ -353,12 +353,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 // FIXME: for variadic support, do we have to somehow determine callee's extra_args?
                 let callee_fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?;
 
-                if callee_fn_abi.c_variadic != caller_fn_abi.c_variadic {
-                    throw_ub_format!(
-                        "calling a c-variadic function via a non-variadic call site, or vice versa"
-                    );
-                }
-                if callee_fn_abi.c_variadic {
+                if callee_fn_abi.c_variadic || caller_fn_abi.c_variadic {
                     throw_unsup_format!("calling a c-variadic function is not supported");
                 }