Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require to implement a trait method if a constraint is not satisfied #26880

Closed
IvanUkhov opened this issue Jul 8, 2015 · 2 comments
Closed
Labels
A-traits Area: Trait system

Comments

@IvanUkhov
Copy link
Contributor

Consider the following example:

trait Foo {
    fn foo(&self);
    fn bar(&self) where Self: Bar;
}

trait Bar {
}

struct Baz;

impl Foo for Baz {
    fn foo(&self) {}
}

The example produces the following error:

<anon>:11:1: 13:2 error: not all trait items implemented, missing: `bar` [E0046]
<anon>:11 impl Foo for Baz {
<anon>:12     fn foo(&self) {}
<anon>:13 }

However, Baz doesn’t implement Bar, and presumably it shouldn’t be required to implement bar when implementing Foo.

Regards,
Ivan

@steveklabnik
Copy link
Member

The Foo trait here has a bar method that's not implemented.

@steveklabnik steveklabnik added the A-traits Area: Trait system label Jul 9, 2015
@apasel422
Copy link
Contributor

This appears to be a duplicate of #20021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system
Projects
None yet
Development

No branches or pull requests

3 participants