Remove explicit S type parameters (#5275)
* Remove explicit `S` type parameters This commit removes the explicit `S` type parameter on `Func::typed` and `Instance::get_typed_func`. Historical versions of Rust required that this be a type parameter but recent rustcs support a mixture of explicit type parameters and `impl Trait`. This removes, at callsites, a superfluous `, _` argument which otherwise never needs specification. * Fix mdbook examples
This commit is contained in:
@@ -285,7 +285,7 @@ fn global_drops_externref() -> anyhow::Result<()> {
|
||||
"#,
|
||||
)?;
|
||||
let instance = Instance::new(&mut store, &module, &[])?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, (), _>(&mut store, "run")?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, ()>(&mut store, "run")?;
|
||||
let flag = Arc::new(AtomicBool::new(false));
|
||||
let externref = ExternRef::new(SetFlagOnDrop(flag.clone()));
|
||||
run.call(&mut store, Some(externref))?;
|
||||
@@ -335,7 +335,7 @@ fn table_drops_externref() -> anyhow::Result<()> {
|
||||
"#,
|
||||
)?;
|
||||
let instance = Instance::new(&mut store, &module, &[])?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, (), _>(&mut store, "run")?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, ()>(&mut store, "run")?;
|
||||
let flag = Arc::new(AtomicBool::new(false));
|
||||
let externref = ExternRef::new(SetFlagOnDrop(flag.clone()));
|
||||
run.call(&mut store, Some(externref))?;
|
||||
@@ -387,7 +387,7 @@ fn gee_i_sure_hope_refcounting_is_atomic() -> anyhow::Result<()> {
|
||||
)?;
|
||||
|
||||
let instance = Instance::new(&mut store, &module, &[])?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, (), _>(&mut store, "run")?;
|
||||
let run = instance.get_typed_func::<Option<ExternRef>, ()>(&mut store, "run")?;
|
||||
|
||||
let flag = Arc::new(AtomicBool::new(false));
|
||||
let externref = ExternRef::new(SetFlagOnDrop(flag.clone()));
|
||||
@@ -482,7 +482,7 @@ fn no_gc_middle_of_args() -> anyhow::Result<()> {
|
||||
)?;
|
||||
|
||||
let instance = linker.instantiate(&mut store, &module)?;
|
||||
let func = instance.get_typed_func::<(), (), _>(&mut store, "run")?;
|
||||
let func = instance.get_typed_func::<(), ()>(&mut store, "run")?;
|
||||
func.call(&mut store, ())?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user