Make too many imports an instantiation error (#1478)

* Make too many imports an instantiation error

Previously we'd accidentally only take the head of the list when
instantiating, but instead this changes the API to require exactly the
right number of imports.
This commit is contained in:
Alex Crichton
2020-04-07 12:05:28 -05:00
committed by GitHub
parent 6a68130d5b
commit 1a2ecccbeb
2 changed files with 21 additions and 0 deletions

View File

@@ -124,6 +124,14 @@ impl Instance {
}
}
if imports.len() != module.imports().len() {
bail!(
"wrong number of imports provided, {} != {}",
imports.len(),
module.imports().len()
);
}
module.register_frame_info();
let config = store.engine().config();
let instance_handle = instantiate(