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
|
src/librustdoc/clean/utils.rs
Outdated
There was a problem hiding this comment.
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.
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.
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.*_didfieldsTyParamdirectlyResinexternal_path()hir_idparameter fromresolve_typeexternal_path()is_traitargumentexternal_generic_args()r? @jyn514