-
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
rustdoc: render bounds of cross-crate GAT params #103190
rustdoc: render bounds of cross-crate GAT params #103190
Conversation
// as opposed to being located in the where clause. | ||
let predicates = tcx.explicit_predicates_of(assoc_item.def_id).predicates; | ||
let predicates = | ||
tcx.arena.alloc_from_iter(bounds.into_iter().chain(predicates).copied()); |
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 have to manually merge the result of tcx.explicit_item_bounds
and tcx.explicit_predicates_of
even though there is a query that already does both, namely tcx.trait_explicit_predicates_and_bounds
. However, the latter only works for local definitions (and therefore only accepts LocalDefId
s) and we obviously need to be able to handle cross-crate definitions.
Alternatively, I can remove the bound re-sugaring and only keep the type Out14<P, Q>
where
P: Copy + Eq,
Q: ?Sized This would be similar to what we currently do for (cross-crate) trait parameters. E.g. In any case, as far as I know (and as far as the existing comments vaguely state) there truly is no means to get to know if the user actually wrote the bounds in the where-clause or directly attached to the parameters since this seems to be lost when desugaring, when storing the crate metadata and/or when the data is cleaned. I am not sure which one is the case. Maybe we can reconstruct this piece of information by looking at the spans (if available). No idea. Just note that this is a well-known shortcoming of rustdoc's cross-crate documentation abilities. Confer several A-cross-crate-reexports issues. |
Apart from my question, looks all good to me, thanks! |
b1d02fe
to
2cc4a0a
Compare
ready |
Thanks! @bors r+ |
…oss-crate-gat-params, r=GuillaumeGomez rustdoc: render bounds of cross-crate GAT params Follow-up to rust-lang#102439. Render the trait bounds of type parameters of cross-crate (generic) associated types. `@rustbot` label T-rustdoc A-cross-crate-reexports r? `@GuillaumeGomez`
…oss-crate-gat-params, r=GuillaumeGomez rustdoc: render bounds of cross-crate GAT params Follow-up to rust-lang#102439. Render the trait bounds of type parameters of cross-crate (generic) associated types. ``@rustbot`` label T-rustdoc A-cross-crate-reexports r? ``@GuillaumeGomez``
…oss-crate-gat-params, r=GuillaumeGomez rustdoc: render bounds of cross-crate GAT params Follow-up to rust-lang#102439. Render the trait bounds of type parameters of cross-crate (generic) associated types. ```@rustbot``` label T-rustdoc A-cross-crate-reexports r? ```@GuillaumeGomez```
…oss-crate-gat-params, r=GuillaumeGomez rustdoc: render bounds of cross-crate GAT params Follow-up to rust-lang#102439. Render the trait bounds of type parameters of cross-crate (generic) associated types. ````@rustbot```` label T-rustdoc A-cross-crate-reexports r? ````@GuillaumeGomez````
Rollup of 7 pull requests Successful merges: - rust-lang#102602 (Slightly tweak comments wrt `lint_overflowing_range_endpoint`) - rust-lang#103190 (rustdoc: render bounds of cross-crate GAT params) - rust-lang#103224 (Allow semicolon after closure within parentheses in macros) - rust-lang#103280 ((rust-lang#102929) Implement `String::leak` (attempt 2)) - rust-lang#103329 (Add a forgotten check for NonNull::new_unchecked's precondition) - rust-lang#103346 (Adjust argument type for mutable with_metadata_of (rust-lang#75091)) - rust-lang#103360 (Reduce false positives in msys2 detection) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
… where-clause to param declaration site I've overlooked this in rust-lang#103190.
Follow-up to #102439.
Render the trait bounds of type parameters of cross-crate (generic) associated types.
@rustbot label T-rustdoc A-cross-crate-reexports
r? @GuillaumeGomez