-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Confusing error message when returning impl Trait with multiple lifetimes #49431
Comments
It seems like we should add an artificial syntactic restriction to |
Does this work yet? I didn't get the above error message, but I did get others. |
I appear to still get the same error message on the playground. |
Well, my case is similar but slightly different... the code is too tangled to post here. Does anyone fancy taking this on as a PR? |
Triage: no change. |
Current output:
|
Given
you currently (
rustc 1.26.0-nightly (188e693b3 2018-03-26)
) get the errorsThis not being an allowed syntax was briefly mentioned by @nikomatsakis in #34511, quoting the relevant part of the comment:
As far as I recall/can discover this limitation was never followed up on in that thread.
After some RFC spelunking I cannot find anything restricting a type bound to having at most a single lifetime bound, RFC 192 Appendix B may be relevant, but I don't believe that the
Trait
part ofimpl Trait
is an "object type", it seems to me to be a "type parameter bound". Re-reading theimpl Trait
RFC series doesn't appear to clear this up, exactly what sort of syntaxTrait
is is never explicitly named, the original RFC simply saysIt seems to me that supporting multiple lifetime bounds on
impl Trait
should be fine, conceptually it seems to be the equivalent of:Whether or not
impl Trait
can be extended to support multiple lifetimes, it seems like there should be an error message that the formimpl Foo + 'a + 'b
is not valid currently, rather than some weird lifetime mismatch errors.The text was updated successfully, but these errors were encountered: