Assert that the non-fixed inputs to return match the function's signature.

This commit is contained in:
Dan Gohman
2018-11-06 12:08:34 -08:00
committed by Benjamin Bouvier
parent 05c0b3bdd1
commit 681cb5e20a

View File

@@ -348,6 +348,11 @@ impl<'a> Context<'a> {
// Similarly, for return instructions, collect uses of ABI-defined
// return values.
if self.cur.func.dfg[inst].opcode().is_return() {
debug_assert_eq!(
self.cur.func.dfg.inst_variable_args(inst).len(),
self.cur.func.signature.returns.len(),
"The non-fixed arguments in a return should follow the function's signature."
);
for (ret_idx, (ret, &arg)) in
self.cur.func.signature.returns.iter().zip(args).enumerate()
{