You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow trait methods to return impl Trait types. #65481
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.
Activity
jonas-schievink commentedon Oct 16, 2019
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.