-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Erroneous "conflicting implementations" message #24165
Comments
This is not a bug, as these impls do conflict: fn foo<F: Foo>() {}
fn main() {
foo::<Vec<i32>>();
} One solution involves parameterizing trait Foo<T> {}
impl<T> Foo<T> for T where T: Copy {}
impl<T> Foo<T> for Vec<T> where T: Copy {}
fn main() {
} |
|
Oh, I see. This may be a result of #23867. |
In particular, https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md#type-locality-and-negative-reasoning seems relevant. |
/cc @nikomatsakis |
Yes, this is now the intended behavior, due to rust-lang/rfcs#1023, as @apasel422 points out. And this is also one of the known cases where it'd be nice to be able to extend the system, though the best way to do that is not yet agreed upon. |
Ah. So given that the type system is now less powerful indefinitely, what's the appropriate course of action if I'm writing a
@apasel422 I'm having some trouble using your fix for this, since not everything is neatly parameterized on some The reason I'm not using |
@bfops: I'd suggest bringing this up in http://users.rust-lang.org/ and closing this issue, but the solution depends on how you want to be able to use this trait. My type parameter suggestion was just based on your reduced test case, but, in general, you won't be able to provide multiple |
This used to compile, but now it fails with
error: conflicting implementations for trait
.The text was updated successfully, but these errors were encountered: