I believe this is due to invalid assumptions in the compiler's trait
implementation (related to issue #7590). In particular some code
assumes that a trait will only be implemented for a single set of type
parameters, and it may be that this code is causing incorrect type
unifications. In general the vtable matching code is due to be
restructured and rewritten.


Niko

On Mon, Sep 30, 2013 at 12:06:51AM -0700, Vadim wrote:
> Hi,
> I don't understand why the following produces an error:
> 
> >cat test.rs
> 
> trait Foo<T> {}
> struct X1;
> struct X2;
> 
> impl<T: Foo<X1>> Foo<X2> for T {}
> 
> fn main() {}
> 
> >rustc test.rs
> test.rs:6:0: 6:33 error: expected Foo<X2>, but found Foo<X1> (expected
> struct X2 but found struct X1)
> test.rs:6 impl<T: Foo<X1>> Foo<X2> for T {}
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> error: aborting due to previous error
> 
> 
> I'm trying to say "Any type that implements Foo<X1> also implements
> Foo<X2>"...   What's wrong here?

> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to