-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rust's coherence checking overconservative #10601
Comments
This is the intended behaviour. A crate can only define a trait if either the type it's defining it for or the trait is local to the crate. This prevents libraries from being able to create conflicting trait implementations. It wouldn't be good if Rust libraries could be incompatible with linking to each other from a basic language feature like this. |
@thestinger I believe that rule means that this can be valid, because the compiler knows that someone can't define |
Ah, sorry, I missed that the |
cc me. cc #5527. |
This is now working because of conditional/multi dispatch. @nikomatsakis can we close this? |
Yes. |
…n, r=llogiq Add [`manual_slice_size_calculation`] Fixes: rust-lang#10518 --- changelog: new lint [`manual_slice_size_calculation`]
Code:
Output:
Expected:
Compile normally, as there is no
impl Rand for ~[T]
.The text was updated successfully, but these errors were encountered: