-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Description
Not sure if this has already been brought up or discussed elsewhere, and if so, I apologize in advance.
trait Xxx {
type Target;
}
trait Yyy {}
trait Zzz {
fn do_stuff(&self) -> i32;
}
struct Www{}
struct Uuu{}
struct Vvv {}
struct Qqq {}
impl Xxx for Vvv {
type Target = Www;
}
//This is disallowed by the compiler
/*impl Xxx for Vvv {
type Target = Uuu;
}*/
impl<T> Zzz for T where T: Xxx<Target=Www> {
fn do_stuff(&self) -> i32 {
1
}
}
//Therefore this should be possible. The two sets here are disjoint
//with no possibility of overlap
impl<T> Zzz for T where T: Xxx<Target=Uuu> {
fn do_stuff(&self) -> i32 {
2
}
}
fn main() {
}Errors:
Compiling playground v0.0.1 (file:///playground)
error[E0119]: conflicting implementations of trait `Zzz`:
--> src/main.rs:32:1
|
24 | impl<T> Zzz for T where T: Xxx<Target=Www> {
| ------------------------------------------ first implementation here
...
32 | impl<T> Zzz for T where T: Xxx<Target=Uuu> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
No labels