-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Handle generic bounds in a uniform way in HIR #93803
Conversation
Some changes occurred in cc @camelid rustdoc-json-types is a public (although nightly-only) API. Consider changing cc @CraftSpider,@aDotInTheVoid Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
I'm not sure how important this is, but AFAIR this is the primary reason why it wasn't done before. |
This comment has been minimized.
This comment has been minimized.
I'm not sure I'd mind seeing all bounds as |
I've kind of thought of doing this anyway, so I'm slightly in favor. This would also improve consistency since for some reason, cross-crate re-exports always display their bounds as |
I think its important to show that their is a difference in rustdoc html, as The JSON output also has a significant regression in that Unrelated, but we should probably merge |
This comment was marked as outdated.
This comment was marked as outdated.
|
ff6cc12
to
3bb9c89
Compare
@aDotInTheVoid how do I run the json tests? |
This comment has been minimized.
This comment has been minimized.
src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
Outdated
Show resolved
Hide resolved
|
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 need to go over the code changes, but the output changes look reasonable to me (with some nitpicking for things we could improve) so it's likely that the code changes themselves are too. I'll read the changes now.
I agree with @camelid, if the signature uses |
I don't see any changes to Clippy's tests. The changes to lifetimes.rs seem reasonable AFAICT. Do you get test failures in Clippy? |
Of course, the desugaring will not appear in docs and errors. Only the internal representation is changed by this PR. |
@@ -6,12 +6,6 @@ LL | fn unused_lt<'a>(x: u8) {} | |||
| | |||
= note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings` | |||
|
|||
error: this lifetime isn't used in the function definition |
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.
@flip1995 I mean this change, and the one below. I don't understand how clippy use to account for lifetime uses in bounds and not where clauses.
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 can't really tell what would cause this from just looking at the Clippy changes. I'll have to review and understand the other changes to rustc in this PR. This might take me a few days until I get to that though.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #93893) made this pull request unmergeable. Please resolve the merge conflicts. |
f9089ca
to
ff050e4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ff050e4
to
c3a9feb
Compare
Finished benchmarking commit (d201c81): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Footnotes |
@cjgillot It looks like the pre-merge perf justification in #93803 (comment) was that the improvements balanced regressions, but post-merge we are not seeing any improvements. I think the (presumably) improve code quality/maintenance may still justify this change, but it would be good to re-assess from your perspective. |
I must have missed this or forgotten about it. This seems counterintuitive to me in the context of the TAIT refactoring. Of course, @oli-obk knows more than me on this, but surprising nonetheless. |
…ession, r=notriddle Fix jump to def regression rust-lang#93803 introduced a regression in the "jump to def" feature. This fixes it. Nice side-effect: it adds a new regression test. :) I also used this opportunity to add documentation about this unstable feature in the rustdoc book. cc `@cjgillot` r? `@notriddle`
…ession, r=notriddle Fix jump to def regression rust-lang#93803 introduced a regression in the "jump to def" feature. This fixes it. Nice side-effect: it adds a new regression test. :) I also used this opportunity to add documentation about this unstable feature in the rustdoc book. cc `@cjgillot` r? `@notriddle`
…ession, r=notriddle Fix jump to def regression rust-lang#93803 introduced a regression in the "jump to def" feature. This fixes it. Nice side-effect: it adds a new regression test. :) I also used this opportunity to add documentation about this unstable feature in the rustdoc book. cc ``@cjgillot`` r? ``@notriddle``
With rust-lang#93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a impl Trait or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during HIR lowering.
…cjgillot Track if a where bound comes from a impl Trait desugar With rust-lang#93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering. r? `@cjgillot` cc `@estebank` (as the reviewer of rust-lang#93803)
…-errors Fortify handing of where bounds on trait & trait alias definitions Closes rust-lang#96664 Closes rust-lang#96665 Since rust-lang#93803, when listing all bounds and predicates we now need to account for the possible presence of predicates on any of the generic parameters. Both bugs were hidden by the special handling of bounds at the generic parameter declaration position. Trait alias expansion used to confuse predicates on `Self` and where predicates. Exiting too late when listing all the bounds caused a cycle error.
Track if a where bound comes from a impl Trait desugar With rust-lang/rust#93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering. r? `@cjgillot` cc `@estebank` (as the reviewer of #93803)
With rust-lang#93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a impl Trait or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during HIR lowering.
Generic bounds in HIR used to be split between bounds in the parameter definition and bounds in a where clause. This PR attempts to store all of those as where predicates.
This effectively desugars
into
(where _V is actually hidden and called "impl Copy").
I managed to make compiler warnings more uniform.
About rustdoc: is making this desugaring user-visible acceptable?
About clippy: I don't understand the subtle logic in the
needless-lifetimes
lint.r? @estebank