Get rid of fake DefIds in rustdoc #83183
Labels
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Right now, rustdoc has a whole mess of awful hacks to be able to add DefIds for things that aren't definitions:
rust/src/librustdoc/core.rs
Lines 131 to 140 in 4c10c84
It's unfortunate that these are needed at all, but it's really unfortunate that these have the same type as normal
DefId
s - they are not valid and cannot be passed to rustc APIs; trying to do so will usually panic. It also leads to lots of other hacks, like giving primitives DefIds: #83083 (comment)A better alternative is to add a new wrapper type, something like
That makes it clear that the two are very different, and doesn't require hacks in rustdoc or rustc.
Things that can be removed once this is implemented:
rust/src/librustdoc/core.rs
Line 68 in 4c10c84
rust/src/librustdoc/core.rs
Line 145 in 4c10c84
rust/src/librustdoc/core.rs
Line 172 in 4c10c84
rust/src/librustdoc/clean/types.rs
Line 98 in 4c10c84
rust/src/librustdoc/clean/types.rs
Line 316 in 4c10c84
rust/compiler/rustc_hir/src/definitions.rs
Line 90 in 4c10c84
rust/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Line 468 in 4c10c84
The text was updated successfully, but these errors were encountered: