-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
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
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.