Unnecessary "Parameter Foo
is never used" error when Foo
is used in generic bounds
#35146
Labels
A-type-system
Area: Type system
When creating
struct
s that use generics parameters for use in generic bounds, the compiler throws an error that such parameters aren't being used when they are actually being used in the bound. For example, take the followingstruct
/trait
pair:This code has no reason not to compile, but it still fails with the following error:
Similarly, if a lifetime is used in the trait, the same error occurs:
Now, using
PhantomData
does indeed work for these cases and correctly suppresses the error. However, the error should not occur here in the first place, as the relevant parameters are being used in thestruct
, albeit not directly. Instead, the compiler should just accept thePhantomData
-less code as valid.Meta
The text was updated successfully, but these errors were encountered: