Trait with type-dependent optional function forces implementation regardless of type #110219
Labels
A-trait-system
Area: Trait system
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
I tried this code (from this Stack Overflow question):
I expected to see this happen:
It compiles as
do_member
is only available if the type parameterT
implementsDoable
whichMyMember
doesn't.Instead, this happened:
It doesn't compile with this error message:
Meta
rustc --version --verbose
:and
Workaround
To work around this one can simply implement the
do_member
method without thewhere
clause:but it feels rather pointless to implement a method that's not callable and doesn't do anything.
The text was updated successfully, but these errors were encountered: