From 700eca7dfe6d0314b685e51ae200ca0e30c32541 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 1 Feb 2022 09:46:46 -0800 Subject: [PATCH] fix #3749: returns count should count the returns, not the params. --- crates/types/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 573c699f4e0b..7db21a2a010b 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -97,7 +97,10 @@ impl WasmFuncType { #[inline] pub fn new(params: Box<[WasmType]>, returns: Box<[WasmType]>) -> Self { let externref_params_count = params.iter().filter(|p| **p == WasmType::ExternRef).count(); - let externref_returns_count = params.iter().filter(|r| **r == WasmType::ExternRef).count(); + let externref_returns_count = returns + .iter() + .filter(|r| **r == WasmType::ExternRef) + .count(); WasmFuncType { params, externref_params_count,