Hi,

When I try to compile the below program, why do I get a "conflicting
implementations" error? I do not define any implementations of Bar, so
the parameterized impl of Foo should never get instantiated, right?

-------------------

trait Foo {
    fn foo() -> Self;
}

trait Bar : std::num::Zero { }

impl <T : Bar> Foo for T {
    fn foo() -> T {
        std::num::Zero::zero()
    }
}

impl Foo for u16 {
    fn foo () -> u16 {
        100
    }
}

fn main() {

    // should be 100
    let x : u16 = Foo::foo();
    printfln!("%s", x);

}

// error: conflicting implementations for trait `Foo`

------------------


When I asked about this on IRC, cmr indicated that this is probably
the intended behavior of rustc, but that most people want to change
it. Is that true, and when can we expect a fix?


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

Reply via email to