Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Enable `clippy::extra_unused_type_parameters` lint (#12004)

Alex Crichton0145a99db35a
diff --git a/Cargo.toml b/Cargo.toml
index 24489f96bd..578d4b201c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -225,6 +225,7 @@ allow_attributes_without_reason = 'warn'
from_over_into = 'warn'
redundant_field_names = 'warn'
multiple_bound_locations = 'warn'
+extra_unused_type_parameters = 'warn'
[workspace.dependencies]
# Public crates related to Wasmtime.
diff --git a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
index 7b30989dd1..89f2d6abf6 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
@@ -168,7 +168,7 @@ fn lower<T: func::Lower + Send + 'static, B: WriteBuffer<T>, U: 'static>(
Ok(())
}
-fn lift<T: func::Lift + Send + 'static, B: ReadBuffer<T>, U>(
+fn lift<T: func::Lift + Send + 'static, B: ReadBuffer<T>>(
lift: &mut LiftContext<'_>,
ty: Option<InterfaceType>,
buffer: &mut B,
@@ -699,7 +699,7 @@ impl<'a, T> Source<'a, T> {
&mut LiftContext::new(store.0.store_opaque_mut(), &options, self.instance.unwrap());
let ty = payload(ty, cx.types);
let old_remaining = buffer.remaining_capacity();
- lift::<T, B, S::Data>(
+ lift::<T, B>(
cx,
ty,
buffer,
diff --git a/winch/codegen/src/codegen/builtin.rs b/winch/codegen/src/codegen/builtin.rs
index 8de1980ed9..8a1e814bac 100644
--- a/winch/codegen/src/codegen/builtin.rs
+++ b/winch/codegen/src/codegen/builtin.rs
@@ -145,7 +145,7 @@ macro_rules! declare_function_sig {
$(
$( #[ $attr ] )*
- pub(crate) fn $name<A: ABI, P: PtrSize>(&mut self) -> Result<BuiltinFunction> {
+ pub(crate) fn $name<A: ABI>(&mut self) -> Result<BuiltinFunction> {
if self.$name.is_none() {
let params = vec![ $(self.$param() ),* ];
let result = vec![ $(self.$result() )?];
diff --git a/winch/codegen/src/codegen/mod.rs b/winch/codegen/src/codegen/mod.rs
index 1fcbd18eba..393f42f9b9 100644
--- a/winch/codegen/src/codegen/mod.rs
+++ b/winch/codegen/src/codegen/mod.rs
@@ -569,10 +569,7 @@ where
assert!(self.tunables.table_lazy_init, "unsupported eager init");
let table_data = self.env.resolve_table_data(table_index);
let ptr_type = self.env.ptr_type();
- let builtin = self
- .env
- .builtins
- .table_get_lazy_init_func_ref::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.table_get_lazy_init_func_ref::<M::ABI>()?;
// Request the builtin's result register and use it to hold the table
// element value. We preemptively spill and request this register to
@@ -1116,7 +1113,7 @@ where
}
self.emit_fuel_increment()?;
- let out_of_fuel = self.env.builtins.out_of_gas::<M::ABI, M::Ptr>()?;
+ let out_of_fuel = self.env.builtins.out_of_gas::<M::ABI>()?;
let fuel_reg = self.context.without::<Result<Reg>, M, _>(
&out_of_fuel.sig().regs,
self.masm,
@@ -1185,7 +1182,7 @@ where
// The continuation branch if the current epoch hasn't reached the
// configured deadline.
let cont = self.masm.get_label()?;
- let new_epoch = self.env.builtins.new_epoch::<M::ABI, M::Ptr>()?;
+ let new_epoch = self.env.builtins.new_epoch::<M::ABI>()?;
// Checks for runtime limits (e.g., fuel, epoch) are special since they
// require inserting arbitrary function calls and control flow.
@@ -1478,8 +1475,8 @@ where
// Put the target memory index as the first argument.
let stack_len = self.context.stack.len();
let builtin = match kind {
- AtomicWaitKind::Wait32 => self.env.builtins.memory_atomic_wait32::<M::ABI, M::Ptr>()?,
- AtomicWaitKind::Wait64 => self.env.builtins.memory_atomic_wait64::<M::ABI, M::Ptr>()?,
+ AtomicWaitKind::Wait32 => self.env.builtins.memory_atomic_wait32::<M::ABI>()?,
+ AtomicWaitKind::Wait64 => self.env.builtins.memory_atomic_wait64::<M::ABI>()?,
};
let builtin = self.prepare_builtin_defined_memory_arg(
MemoryIndex::from_u32(arg.memory),
@@ -1529,7 +1526,7 @@ where
let addr = self.context.pop_to_reg(self.masm, None)?;
// Put the target memory index as the first argument.
- let builtin = self.env.builtins.memory_atomic_notify::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.memory_atomic_notify::<M::ABI>()?;
let stack_len = self.context.stack.len();
let builtin = self.prepare_builtin_defined_memory_arg(
MemoryIndex::from_u32(arg.memory),
diff --git a/winch/codegen/src/visitor.rs b/winch/codegen/src/visitor.rs
index f22debacb5..7a20c14676 100644
--- a/winch/codegen/src/visitor.rs
+++ b/winch/codegen/src/visitor.rs
@@ -778,7 +778,7 @@ where
&mut self.context,
OperandSize::S32,
|env, cx, masm| {
- let builtin = env.builtins.floor_f32::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.floor_f32::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -791,7 +791,7 @@ where
&mut self.context,
OperandSize::S64,
|env, cx, masm| {
- let builtin = env.builtins.floor_f64::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.floor_f64::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -804,7 +804,7 @@ where
&mut self.context,
OperandSize::S32,
|env, cx, masm| {
- let builtin = env.builtins.ceil_f32::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.ceil_f32::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -817,7 +817,7 @@ where
&mut self.context,
OperandSize::S64,
|env, cx, masm| {
- let builtin = env.builtins.ceil_f64::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.ceil_f64::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -830,7 +830,7 @@ where
&mut self.context,
OperandSize::S32,
|env, cx, masm| {
- let builtin = env.builtins.nearest_f32::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.nearest_f32::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -843,7 +843,7 @@ where
&mut self.context,
OperandSize::S64,
|env, cx, masm| {
- let builtin = env.builtins.nearest_f64::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.nearest_f64::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -856,7 +856,7 @@ where
&mut self.context,
OperandSize::S32,
|env, cx, masm| {
- let builtin = env.builtins.trunc_f32::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.trunc_f32::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -869,7 +869,7 @@ where
&mut self.context,
OperandSize::S64,
|env, cx, masm| {
- let builtin = env.builtins.trunc_f64::<M::ABI, M::Ptr>()?;
+ let builtin = env.builtins.trunc_f64::<M::ABI>()?;
FnCall::emit::<M>(env, masm, cx, Callee::Builtin(builtin))
},
)
@@ -1662,7 +1662,7 @@ where
.stack
.insert_many(at, &[table.try_into()?, elem.try_into()?]);
- let builtin = self.env.builtins.table_init::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.table_init::<M::ABI>()?;
FnCall::emit::<M>(
&mut self.env,
self.masm,
@@ -1678,7 +1678,7 @@ where
.stack
.insert_many(at, &[dst.try_into()?, src.try_into()?]);
- let builtin = self.env.builtins.table_copy::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.table_copy::<M::ABI>()?;
FnCall::emit::<M>(
&mut self.env,
self.masm,
@@ -1703,7 +1703,7 @@ where
let table_index = TableIndex::from_u32(table);
let table_ty = self.env.table(table_index);
let builtin = match table_ty.ref_type.heap_type {
- WasmHeapType::Func => self.env.builtins.table_grow_func_ref::<M::ABI, M::Ptr>()?,
+ WasmHeapType::Func => self.env.builtins.table_grow_func_ref::<M::ABI>()?,
_ => bail!(CodeGenError::unsupported_wasm_type()),
};
@@ -1741,7 +1741,7 @@ where
CodeGenError::unsupported_wasm_type()
);
- let builtin = self.env.builtins.table_fill_func_ref::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.table_fill_func_ref::<M::ABI>()?;
let at = self.context.stack.ensure_index_at(3)?;
@@ -1791,7 +1791,7 @@ where
}
fn visit_elem_drop(&mut self, index: u32) -> Self::Output {
- let elem_drop = self.env.builtins.elem_drop::<M::ABI, M::Ptr>()?;
+ let elem_drop = self.env.builtins.elem_drop::<M::ABI>()?;
self.context.stack.extend([index.try_into()?]);
FnCall::emit::<M>(
&mut self.env,
@@ -1807,7 +1807,7 @@ where
self.context
.stack
.insert_many(at, &[mem.try_into()?, data_index.try_into()?]);
- let builtin = self.env.builtins.memory_init::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.memory_init::<M::ABI>()?;
FnCall::emit::<M>(
&mut self.env,
self.masm,
@@ -1831,7 +1831,7 @@ where
let at = self.context.stack.ensure_index_at(4)?;
self.context.stack.insert_many(at, &[dst_mem.try_into()?]);
- let builtin = self.env.builtins.memory_copy::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.memory_copy::<M::ABI>()?;
FnCall::emit::<M>(
&mut self.env,
@@ -1846,7 +1846,7 @@ where
let at = self.context.stack.ensure_index_at(3)?;
let mem = MemoryIndex::from_u32(mem);
- let builtin = self.env.builtins.memory_fill::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.memory_fill::<M::ABI>()?;
let builtin = self.prepare_builtin_defined_memory_arg(mem, at, builtin)?;
FnCall::emit::<M>(&mut self.env, self.masm, &mut self.context, builtin)?;
@@ -1864,7 +1864,7 @@ where
// The stack at this point contains: [ delta ]
// The desired state is
// [ vmctx, delta, index ]
- let builtin = self.env.builtins.memory_grow::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.memory_grow::<M::ABI>()?;
let builtin = self.prepare_builtin_defined_memory_arg(mem, at + 1, builtin)?;
let heap = self.env.resolve_heap(mem);
@@ -1890,7 +1890,7 @@ where
fn visit_data_drop(&mut self, data_index: u32) -> Self::Output {
self.context.stack.extend([data_index.try_into()?]);
- let builtin = self.env.builtins.data_drop::<M::ABI, M::Ptr>()?;
+ let builtin = self.env.builtins.data_drop::<M::ABI>()?;
FnCall::emit::<M>(
&mut self.env,
self.masm,