-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Error code E0794 for late-bound lifetime parameter error. #107416
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
Conversation
(rustbot has picked a reviewer for you, use r? to override)
Some changes occurred in diagnostic error codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small suggestions that, I think, make the explanation even clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to talk about not appearing in "a generic type constraint" rather than in "a where clause", as the 'a
lifetime parameters in both fn<'a, T: Trait<'a>>(t: T)
and fn<'a>(t: impl Trait<'a>)
are early bound without there being any where
clause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what you mean? https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c30a35a698a82969827f8260139c0f9d
It is possible in the sense that it just generates a warning, but warns about it being an error in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, only just saw your comment (the trials and tribulations of GitHub mobile!). Yes, _bar_fn2
in your playground is what I meant—a number of the tests output the error message "cannot specify lifetime arguments explicitly if late bound lifetime parameters are present"
, but I didn't appreciate they were only warnings (which compiletest denies/upgrades to errors); I think it'd still be helpful to make some reference to it?
That _bar_fn3
in your playground compiles is completely consistent with your existing explanation: no attempt was made to (erroneously) specify concrete lifetimes for late-bound parameters in a function reference, nor was the function reference cast to a pointer that would require explicit universal quantification; lifetime parameter 'b
is early-bound to the lifetime parameter of the second argument, whatever that ends up happening to be—it is existentially, not universally, quantified.
This comment has been minimized.
This comment has been minimized.
I think it's a shame to have lost the bar_fn
example that you originally had, which showed a function with both late and early-bound lifetime parameters, as it helped both to illustrate the difference and to show how early-bound parameters can be, erm, early bound.
@eggyal I agree, but I was unsure whether it fit the error code template while not being too lengthy.
Should I add it back? @GuillaumeGomez
☔ The latest upstream changes (presumably #102513) made this pull request unmergeable. Please resolve the merge conflicts.
5d9511b
to
6d2e252
Compare
Looks good to me and it's ok to add it back even if it's lengthy.
☔ The latest upstream changes (presumably #108488) made this pull request unmergeable. Please resolve the merge conflicts.
6d2e252
to
75563cd
Compare
Bump. Is anything more needed? @GuillaumeGomez @WaffleLapkin
No nothing. Sorry, completely forgot about it. Thanks for working on this!
@bors r+ rollup
Error code E0794 for late-bound lifetime parameter error. This PR addresses [rust-lang#80618](rust-lang#80618).
...iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#107416 (Error code E0794 for late-bound lifetime parameter error.) - rust-lang#108772 (Speed up tidy quite a lot) - rust-lang#109193 (Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests) - rust-lang#109234 (Tweak implementation of overflow checking assertions) - rust-lang#109238 (Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty) - rust-lang#109283 (rustdoc: reduce allocations in `visibility_to_src_with_space`) - rust-lang#109287 (Use `size_of_val` instead of manual calculation) - rust-lang#109288 (Stabilise `unix_socket_abstract`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR addresses #80618.