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

Allow trait methods to return impl Trait types. #65481

Closed
kevincox opened this issue Oct 16, 2019 · 1 comment
Closed

Allow trait methods to return impl Trait types. #65481

kevincox opened this issue Oct 16, 2019 · 1 comment

Comments

@kevincox
Copy link
Contributor

It should be possible for methods in traits to have a return value specified as impl Trait. This would allow traits to return values without having to specify the exact type or wrap in indirection.

This would obviously not be object-safe as the size of the return value would not be known.

@jonas-schievink
Copy link
Contributor

Please refer to https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md#limitation-to-freeinherent-functions for why this isn't allowed. Doing this requires substantial language design efforts and an RFC, so closing in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants