You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
misleading E0392 "parameter T is never used" for every containing struct #66912
Rustc emits an error for every struct containing a struct with an unused type parameter. Unless there's some edge case I'm not thinking of, this seems pointless, as the user will eventually have to fix the "leaf" struct (that which is the root of the problem), which would then fix the entire tree of structs.
I tried this code:
struct Foo<T> {
bar: Bar<T>,
}
struct Bar<T> {}
I expected to see this happen:
error[E0392]: parameter `T` is never used
--> src/main.rs:4:12
|
5 | struct Bar<T> {}
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error: aborting due to previous error
Instead, this happened:
error[E0392]: parameter `T` is never used
--> src/main.rs:1:12
|
1 | struct Foo<T> {
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error[E0392]: parameter `T` is never used
--> src/main.rs:4:12
|
4 | struct Bar<T> {}
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error: aborting due to 2 previous errors
Activity
steveklabnik commentedon Nov 12, 2020
Triage: trying this today, the same error happens.