diff --git a/crates/api/src/func.rs b/crates/api/src/func.rs index b6a4dec62f..ade4917b99 100644 --- a/crates/api/src/func.rs +++ b/crates/api/src/func.rs @@ -502,7 +502,7 @@ impl Func { .signatures() .lookup(self.export.signature) .expect("failed to lookup signature"); - sig.params.len() + sig.params.len() - 2 // skip the two vmctx leading parameters } /// Returns the number of results this function produces. diff --git a/tests/all/func.rs b/tests/all/func.rs index 1cbb3e0814..40616810ed 100644 --- a/tests/all/func.rs +++ b/tests/all/func.rs @@ -74,7 +74,9 @@ fn signatures_match() { let f = Func::wrap(&store, || {}); assert_eq!(f.ty().params(), &[]); + assert_eq!(f.param_arity(), 0); assert_eq!(f.ty().results(), &[]); + assert_eq!(f.result_arity(), 0); let f = Func::wrap(&store, || -> i32 { loop {} }); assert_eq!(f.ty().params(), &[]);