-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error message for why ~/@/&Trait doesn't automatically implement Trait #7914
Comments
Could also maybe have a deriving mode. |
I think auto-implementing it would be much better than deriving. We'll still need to improve the error messages to explain that |
Visiting for triage. The example in the report is still valid. |
We can probably close this, the intention is that |
Yes, object safety plus the soon-to-land (if it dind't already) trait object implements the trait makes this moot. |
…Frednet Advise to put a :: prefix inside the ticks Fixes rust-lang#7914. changelog: Keep an initial `::` when [`doc_markdown`] suggests to use ticks
Consider the following:
The error is:
The reason trait types do not automatically implement their own traits is that if the trait interface has a Self type variable, it does not make sense for it to be called in a heterogeneous way (e.g., if instantiating
fn eq(&self, other: &Self)
with int-as-Eq as the first thing, it makes no sense to pass a str-as-Self as the second.But if the trait has no such problematic interface functions, it should (apparently doesn't yet, but should in the future -- @nikomatsakis) be possible for the user to write an impl with stub methods that do dynamic dispatch.
So, I wish for either (a) a special-case span_note that accompanies this error that instructs the user to write stubs, or (b) recognising a non-problematic trait interface that can be auto-implemented, permitting that, and having a special-case span_note that explains why not in the problematic case.
The text was updated successfully, but these errors were encountered: