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:
Alex Crichton
2022-11-15 23:04:26 -06:00
committed by GitHub
parent 8426904129
commit b0939f6626
50 changed files with 223 additions and 238 deletions

View File

@@ -47,7 +47,7 @@ mod tests {
fn invoke_export(store: &mut Store<()>, instance: Instance, func_name: &str) -> Result<i32> {
let ret = instance
.get_typed_func::<(), i32, _>(&mut *store, func_name)?
.get_typed_func::<(), i32>(&mut *store, func_name)?
.call(store, ())?;
Ok(ret)
}
@@ -175,7 +175,7 @@ mod tests {
// these invoke wasmtime_call_trampoline from callable.rs
{
let read_func = instance.get_typed_func::<(), i32, _>(&mut store, "read")?;
let read_func = instance.get_typed_func::<(), i32>(&mut store, "read")?;
println!("calling read...");
let result = read_func
.call(&mut store, ())
@@ -185,7 +185,7 @@ mod tests {
{
let read_out_of_bounds_func =
instance.get_typed_func::<(), i32, _>(&mut store, "read_out_of_bounds")?;
instance.get_typed_func::<(), i32>(&mut store, "read_out_of_bounds")?;
println!("calling read_out_of_bounds...");
let trap = read_out_of_bounds_func
.call(&mut store, ())