Code
struct Foo<T> {
bar: Bar<T>,
}
struct Bar<T> {}
Current output
error[E0392]: type parameter `T` is never used
--> src/lib.rs:1:12
|
1 | struct Foo<T> {
| ^ unused type parameter
2 | bar: Bar<T>,
| - `T` is named here, but is likely unused in the containing type
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
error[E0392]: type parameter `T` is never used
--> src/lib.rs:5:12
|
5 | struct Bar<T> {}
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
For more information about this error, try `rustc --explain E0392`.
error: could not compile `playground` (lib) due to 2 previous errors
Desired output
error[E0392]: type parameter `T` is never used
--> src/lib.rs:1:12
|
1 | struct Foo<T> {
| ^ unused type parameter
2 | bar: Bar<T>,
| - `T` is named here, but is also unused in `Bar`
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
error[E0392]: type parameter `T` is never used
--> src/lib.rs:5:12
|
5 | struct Bar<T> {}
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
For more information about this error, try `rustc --explain E0392`.
error: could not compile `playground` (lib) due to 2 previous errors
Rationale and extra context
The phrasing "is named here, but is likely unused in the containing type" is confusing.
- What is the "containing type"? It seems like it should refer to
Bar<T>, but then I would call that a "constituent type" of Foo<T> or something like that.
- Why does it say "likely"? The compiler can see the full source code, it should know whether that’s the case or not.
Other cases
Rust Version
the one on https://play.rust-lang.org/
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
The phrasing "is named here, but is likely unused in the containing type" is confusing.
Bar<T>, but then I would call that a "constituent type" ofFoo<T>or something like that.Other cases
Rust Version
Anything else?
No response