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:
@@ -29,7 +29,7 @@ fn loops_interruptable() -> anyhow::Result<()> {
|
||||
let mut store = interruptable_store();
|
||||
let module = Module::new(store.engine(), r#"(func (export "loop") (loop br 0))"#)?;
|
||||
let instance = Instance::new(&mut store, &module, &[])?;
|
||||
let iloop = instance.get_typed_func::<(), (), _>(&mut store, "loop")?;
|
||||
let iloop = instance.get_typed_func::<(), ()>(&mut store, "loop")?;
|
||||
store.engine().increment_epoch();
|
||||
let trap = iloop.call(&mut store, ()).unwrap_err().downcast::<Trap>()?;
|
||||
assert_eq!(trap, Trap::Interrupt);
|
||||
@@ -42,7 +42,7 @@ fn functions_interruptable() -> anyhow::Result<()> {
|
||||
let module = hugely_recursive_module(store.engine())?;
|
||||
let func = Func::wrap(&mut store, || {});
|
||||
let instance = Instance::new(&mut store, &module, &[func.into()])?;
|
||||
let iloop = instance.get_typed_func::<(), (), _>(&mut store, "loop")?;
|
||||
let iloop = instance.get_typed_func::<(), ()>(&mut store, "loop")?;
|
||||
store.engine().increment_epoch();
|
||||
let trap = iloop.call(&mut store, ()).unwrap_err().downcast::<Trap>()?;
|
||||
assert_eq!(trap, Trap::Interrupt);
|
||||
@@ -89,7 +89,7 @@ fn loop_interrupt_from_afar() -> anyhow::Result<()> {
|
||||
|
||||
// Enter the infinitely looping function and assert that our interrupt
|
||||
// handle does indeed actually interrupt the function.
|
||||
let iloop = instance.get_typed_func::<(), (), _>(&mut store, "loop")?;
|
||||
let iloop = instance.get_typed_func::<(), ()>(&mut store, "loop")?;
|
||||
let trap = iloop.call(&mut store, ()).unwrap_err().downcast::<Trap>()?;
|
||||
STOP.store(true, SeqCst);
|
||||
thread.join().unwrap();
|
||||
@@ -125,7 +125,7 @@ fn function_interrupt_from_afar() -> anyhow::Result<()> {
|
||||
|
||||
// Enter the infinitely looping function and assert that our interrupt
|
||||
// handle does indeed actually interrupt the function.
|
||||
let iloop = instance.get_typed_func::<(), (), _>(&mut store, "loop")?;
|
||||
let iloop = instance.get_typed_func::<(), ()>(&mut store, "loop")?;
|
||||
let trap = iloop.call(&mut store, ()).unwrap_err().downcast::<Trap>()?;
|
||||
STOP.store(true, SeqCst);
|
||||
thread.join().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user