Closed
Description
pub struct Foo;
pub trait Bar {
fn bar(&self);
}
pub trait Baz {}
impl<T: Baz> Bar for T {
fn bar(&self) {}
}
impl Baz for Foo {}
pub fn foo(t: ~Foo) {
t.bar() // ~Foo doesn't implement Baz
(*t).bar() // ok b/c Foo implements Baz
}
fn main() {}
From a code-writer point of view, it'd be nice for t
to auto-deref to (*t).bar()
to appease the compiler, but I can see that the compiler may not know a whole lot about this.
If we don't get auto-deref here, perhaps a better error message may work. It's a little confusing to see that ~Foo doesn't implement Baz
when Foo
clearly implements Baz