Skip to content

Manual impls of Foo for Foo should be illegal #20940

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

Closed
huonw opened this issue Jan 11, 2015 · 3 comments
Closed

Manual impls of Foo for Foo should be illegal #20940

huonw opened this issue Jan 11, 2015 · 3 comments
Labels
A-trait-system Area: Trait system

Comments

@huonw
Copy link
Member

huonw commented Jan 11, 2015

A manual implementation of a trait for its own DST is currently legal:

trait Foo { fn gen<A>(&self) {} }

impl<'a> Foo for Foo+'a {}

fn main() {}

but shouldn't be. An object-safe Foo gives an ICE #20939, but should also be plain illegal.

@nikomatsakis
Copy link
Contributor

I actually think that a manual impl for a _non-_object-safe trait is ok. It's the object-safe case that should give a better failure.

@nikomatsakis
Copy link
Contributor

(The fix is presumably to modify coherence to be less focused on impls.)

@huonw
Copy link
Member Author

huonw commented Jan 11, 2015

Closing in favour of #20939 then.

@huonw huonw closed this as completed Jan 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system
Projects
None yet
Development

No branches or pull requests

2 participants