Skip to content

Commit

Permalink
Auto merge of rust-lang#102707 - fmease:rustdoc-render-more-cross-cra…
Browse files Browse the repository at this point in the history
…te-hrtbs-properly, r=GuillaumeGomez

rustdoc: render more cross-crate HRTBs properly

Follow-up to rust-lang#102439.
Render the `for<>` parameter lists of cross-crate higher-rank trait bounds (in where-clauses and in `impl Trait`).

I've added a new field `bound_params` to `clean::WherePredicate::EqPredicate` (mirroring its sibling variant `BoundPredicate`). However, I had to box the existing fields since `EqPredicate` used to be the largest variant (128 bytes on 64-bit systems) and it would only have gotten bigger).
Not sure if you like that approach. As an alternative, I could pass the uncleaned `ty::Predicate` alongside the cleaned `WherePredicate` to the various re-sugaring methods (similar to what `clean::AutoTraitFinder::param_env_to_generics` does).

I haven't yet added the HTML & JSON rendering code for the newly added `bound_params` field since I am waiting for your opinion. Those two rendering code paths should actually be unreachable in practice given we re-sugar all(?) equality predicates to associated type bindings (and arbitrary equality predicates are not part of the Rust surface language at the time of this writing).

If you agree with storing `bound_params` in `EqPredicate`, I think I can use it to greatly simplify the `clean::auto_trait` module (by also using `simplify::merge_bounds`). Maybe I can do that in any case though.

`@rustbot` label T-rustdoc A-cross-crate-reexports
r? `@GuillaumeGomez`
  • Loading branch information
bors committed Oct 6, 2022
2 parents a47b834 + 338c50e commit 08e1f6f
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 08e1f6f

Please sign in to comment.