Closed
Description
This code:
pub trait A<T : B> { fn foo(self) -> T; }
pub struct AImpl;
impl<BImpl> A<BImpl> for AImpl {
fn foo(self) -> BImpl { unimplemented!(); }
}
pub trait B { fn bar(self); }
pub struct BImpl;
impl B for BImpl {
fn bar(self) { unimplemented!(); }
}
...give me this error:
Compiling testproject v0.0.1 (file:///home/virtlink/projects/orion/testproject)
src/lib.rs:6:1: 8:2 error: the trait `B` is not implemented for the type `BImpl` [E0277]
src/lib.rs:6 impl<BImpl> A<BImpl> for AImpl {
src/lib.rs:7 fn foo(self) -> BImpl { unimplemented!(); }
src/lib.rs:8 }
error: aborting due to previous error
Could not compile `testproject`.
This is confusing. The trait B
is implemented for the type BImpl
.
Instead, I have to change this:
impl<BImpl> A<BImpl> for AImpl
...into this:
impl A<BImpl> for AImpl
The error should make that clear.
rustc 1.0.0-nightly (c89de2c56 2015-03-28) (built 2015-03-29)
binary: rustc
commit-hash: c89de2c56baeb61e7cc434924dcc8bedd32b26b8
commit-date: 2015-03-28
build-date: 2015-03-29
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly