Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0091: type parameter `T` is never used
What it meansAn unnecessary type parameter was given in a type alias.
What rustc prints
error[E0091]: type parameter `T` is never used --> main.rs:1:10 | 1 | type Foo<T> = u32; // error: type parameter `T` is never used | ^ unused type parameter | = help: consider removing `T` or referring to it in the body of the type alias = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
An unnecessary type parameter was given in a type alias.
Erroneous code example:
type Foo<T> = u32; // error: type parameter `T` is never used
// or:
type Foo<A, B> = Box<A>; // error: type parameter `B` is never used
Please check you didn't write too many parameters. Example:
type Foo = u32; // ok!
type Foo2<A> = Box<A>; // ok!From rustc --explain E0091 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0308mismatched types
- E0277the trait bound is not satisfied
- E0599no method named X found in the current scope
- E0433failed to resolve
- E0076SIMD vector's only field must be an array
- E0077SIMD vector element type should be a primitive scalar (integer/float/pointer) type
- E0094intrinsic has wrong number of type parameters: found 2, expected 1
- E0107missing generics for struct `Foo`
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?