-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: Cleanup clean
part 1
#88810
Conversation
They can be obtained by accessing the `TyCtxt` where they are needed.
This comment has been minimized.
This comment has been minimized.
12e1f00
to
4343452
Compare
This comment has been minimized.
This comment has been minimized.
It looks like 6b2ee44 is causing CI to fail because some part of rustdoc relies on the |
93a880f
to
481bc33
Compare
Actually, the test failure was just because the ordering of the
|
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.
LGTM with nits fixed
src/librustdoc/clean/utils.rs
Outdated
did: DefId, | ||
trait_did: Option<DefId>, |
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.
did
and trait_did
will never be different if trait_did.is_some()
, right? Could you change trait_did: Option<DefId>
to is_trait: bool
instead to avoid them getting out of sync?
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 did that, and then I did one better: It actually looks like is_trait
is not even necessary. It is only used for sugaring Fn
trait bounds, and rustdoc already checks that the did
is a Fn*
lang item.
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 made them as two separate commits, but I can squash them together if you would prefer.
The order of the `where` bounds on auto trait impls changed because rustdoc currently sorts auto trait `where` bounds based on the `Debug` output for the bound. Now that the bounds have an actual `Res`, they are being unintentionally sorted by their `DefId` rather than their path. So, I had to update a test for the change in ordering of the rendered bounds.
481bc33
to
c2207f5
Compare
If the path is for a trait, it is always true that `trait_did == Some(did)`, so instead, `external_path()` now takes an `is_trait` boolean.
It was only used for sugaring `Fn` trait bounds, and rustdoc already checks that the `did` is for a `Fn` (or `FnMut`, `FnOnce`) lang item, so it's not necessary to also check that the `did` belongs to a trait.
@bors r+ |
📌 Commit 280fc2d has been approved by |
rustdoc: Cleanup `clean` part 1 Split out from rust-lang#88379. These commits are completely independent of each other, and each is a fairly small change (the last few are new commits; they are not from rust-lang#88379): - Remove unnecessary `Cache.*_did` fields - rustdoc: Get symbol for `TyParam` directly - Create a valid `Res` in `external_path()` - Remove unused `hir_id` parameter from `resolve_type` - Fix redundant arguments in `external_path()` - Remove unnecessary `is_trait` argument - rustdoc: Cleanup a pattern match in `external_generic_args()` r? `@jyn514`
…arth Rollup of 7 pull requests Successful merges: - rust-lang#88336 ( Detect stricter constraints on gats where clauses in impls vs trait) - rust-lang#88677 (rustc: Remove local variable IDs from `Export`s) - rust-lang#88699 (Remove extra unshallow from cherry-pick checker) - rust-lang#88709 (generic_const_exprs: use thir for abstract consts instead of mir) - rust-lang#88711 (Rework DepthFirstSearch API) - rust-lang#88810 (rustdoc: Cleanup `clean` part 1) - rust-lang#88813 (explicitly link to external `ena` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Split out from #88379.
These commits are completely independent of each other, and each is a fairly
small change (the last few are new commits; they are not from #88379):
Cache.*_did
fieldsTyParam
directlyRes
inexternal_path()
hir_id
parameter fromresolve_type
external_path()
is_trait
argumentexternal_generic_args()
r? @jyn514