-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-type-systemArea: Type systemArea: Type system
Description
The error message for a trait with an unused parameter recommends the use of PhantomFn even though it's deprecated. It should presumably recommend PhantomData instead, and the documentation on PhantomData should be updated to include an example of how to use it with a trait.
Example (play):
trait Foo<T> {
fn foo(&self);
}yields
<anon>:1:11: 1:12 error: parameter `T` is never used
<anon>:1 trait Foo<T> {
^
<anon>:1:12: 1:12 help: consider removing `T` or using a marker such as `core::marker::PhantomFn`
error: aborting due to previous error
You also get the same error today (suggesting PhantomFn) when using a "marker-like" trait with no functions, which is filed as #22598 (it needs a better error message).
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type system