-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Specialization causes confilicting implementations with T and Option<T> #41140
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
Comments
Hi! |
Hi, I might be confused about this, I thought specialization applied whenever you had more type info than the default type which in this case is I went back a read trough the RFC for specialization and it has a section on Overlap which is what I think might apply here, specifically this section:
In this situation I have an extra constraint on the generic type. I didn't read the discussion on the Specialization PR so if an ammendment was made I might be wrong. I might also have this wrong, but I don't require that |
Since the feature is not finished, I don't really know. My understanding (as in the previous comment) is not like this. I'd bring this discussion to the tracking issue for specialization. It could be a request for clarification of the rules, or a request to widen the rules so that your code is allowed. |
@bluss is right. The first impl is the set of types that implement
We may allow this someday by changing the specialization rules to be a bit more complex than the 'subset' rule, but this is the subset rule. |
Closing this because it isn't a bug. |
Trying to implement a specialization on type
T
ofOption<T>
causes the error E0119 stating that multiple implementations exist.Expected output
Actual output
The program fails to compile with
Version Info
Other Notes
This can potentially be a duplicate of #36587
playpen
The text was updated successfully, but these errors were encountered: