make Module::deserialize's version check optional via Config (#2945)
* make Module::deserialize's version check optional via Config A SerializedModule contains the CARGO_PKG_VERSION string, which is checked for equality when loading. This is a great guard-rail but some users may want to disable this check (e.g. so they can implement their own versioning scheme) * rename config to deserialize_check_wasmtime_version * add test * fix doc links * fix * thank you rustdoc
This commit is contained in:
@@ -24,6 +24,13 @@ fn test_version_mismatch() -> Result<()> {
|
||||
.starts_with("Module was compiled with incompatible Wasmtime version")),
|
||||
}
|
||||
|
||||
// Test deserialize_check_wasmtime_version, which disables the logic which rejects the above.
|
||||
let mut config = Config::new();
|
||||
config.deserialize_check_wasmtime_version(false);
|
||||
let engine = Engine::new(&config).unwrap();
|
||||
unsafe { Module::deserialize(&engine, &buffer) }
|
||||
.expect("module with corrupt version should deserialize when check is disabled");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user