Skip to content

Get rid of fake DefIds in rustdoc - #84707

Merged
bors merged 1 commit into
rust-lang:masterfrom
Stupremee:remove-fake-defids-in-rustdoc
May 4, 2021
Merged

Get rid of fake DefIds in rustdoc#84707
bors merged 1 commit into
rust-lang:masterfrom
Stupremee:remove-fake-defids-in-rustdoc

Conversation

@Stupremee

Copy link
Copy Markdown
Contributor

Right now there are many errors left, but I wanted to show the current state since all that is left to do is fixing the errors.

Resolves#83183

r? @jyn514

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 29, 2021
@jyn514jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2021
@Stupremee
Stupremeeforce-pushed the remove-fake-defids-in-rustdoc branch from f63da48 to b5293a5CompareApril 29, 2021 19:38
@rust-log-analyzer

This comment has been minimized.

@camelid

Copy link
Copy Markdown
Member

Wow, thank you for working on this! expect_real was a good idea :)

Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/clean/utils.rs Outdated
Comment threadsrc/librustdoc/passes/collect_trait_impls.rs Outdated
@Stupremee
Stupremee marked this pull request as ready for review May 1, 2021 12:05
@StupremeeStupremee added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 1, 2021

@jyn514jyn514 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only got about halfway through the changes - the bit about contains_key also applies to lots of other changes.

Comment threadsrc/librustdoc/clean/inline.rs Outdated
Comment threadsrc/librustdoc/core.rs Outdated
Comment threadsrc/librustdoc/formats/cache.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't these be fake for blanket impls?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pubtraitA{}pubtraitB{}impl<T:B>AforT{}

I don't know, but this documents just fine

Comment threadsrc/librustdoc/formats/cache.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the same behavior - before contains_key would return false for fakes. I have a feeling this will ICE.

Comment threadsrc/librustdoc/formats/cache.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling this will ICE.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should paths also accept fake ids, or should we just check if it's real and only then insert it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this didn't ICE documenting libstd, I'm ok with just leaving it as-is.

Comment threadsrc/librustdoc/html/format.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems odd to me this would be real - can't rustdoc generate links to impls? Or is that only intra-doc links?

@jyn514jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2021
@jyn514

Copy link
Copy Markdown
Member

@Stupremee I didn't realize when reviewing that the test suite was passing - that's probably a better indicator of what's correct than my guessing. Can you document the standard library and make sure there's no panics? And then rebase this?

@Stupremee

Copy link
Copy Markdown
ContributorAuthor

std documents just fine. I will rebase now

@Stupremee
Stupremeeforce-pushed the remove-fake-defids-in-rustdoc branch from 6621591 to 5a3f9c4CompareMay 1, 2021 15:41
@Stupremee

Copy link
Copy Markdown
ContributorAuthor

Everything should be ready now 🎉

Comment threadsrc/librustdoc/clean/types.rs Outdated
Comment threadsrc/librustdoc/formats/cache.rs Outdated
@camelid

Copy link
Copy Markdown
Member

@bors rollup=never

This should make it easier to bisect if we get ICE reports.

@bors

bors commented May 3, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #84840) made this pull request unmergeable. Please resolve the merge conflicts.

@Stupremee
Stupremeeforce-pushed the remove-fake-defids-in-rustdoc branch from 327262e to d3274e3CompareMay 4, 2021 12:46
@Stupremee

Copy link
Copy Markdown
ContributorAuthor

Should be ready to merge now. Would be good to merge soon so there are not too many conflicts coming and not too many PRs that need to be rebased on this one.

r? @jyn514

@jyn514

Copy link
Copy Markdown
Member

I'd like to figure out #84707 (comment) first, I don't like merging code when I don't understand how it works. @Manishearth@GuillaumeGomez@Aaron1011 maybe one of you have ideas?

Comment threadsrc/librustdoc/clean/types.rs Outdated
@jyn514

Copy link
Copy Markdown
Member

r=me with Guillaume's comment addressed, this already showing I don't have a good intuition for which ids are fake and which aren't 😆 so it's super helpful!

@Stupremee

Copy link
Copy Markdown
ContributorAuthor

In the future someone could even do a follow up PR and try to minimize the amount of fake DefId's. I might even do that now when renaming everything.

@Manishearth

Copy link
Copy Markdown
Member

That's fair. To be clear, "the renaming" is creating a FakeDefId wrapper and using it everywhere, right? As I said I'm against having DefId mean something different in rustdoc

@Stupremee

Copy link
Copy Markdown
ContributorAuthor

Yes. Thats what I pushed right now. Use FakeDefId whereever required and in some more places, and use DefId for ids that are guaranteed to be real

@GuillaumeGomezGuillaumeGomez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks!

@GuillaumeGomez

Copy link
Copy Markdown
Member

We'll now be waiting for the follow-up PRs. ;)

@bors: r=jyn514,GuillaumeGomez

@bors

bors commented May 4, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit b6120bf has been approved by jyn514,GuillaumeGomez

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 4, 2021
@bors

bors commented May 4, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit b6120bf with merge ae8b84b...

@bors

bors commented May 4, 2021

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: jyn514,GuillaumeGomez
Pushing ae8b84b to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label May 4, 2021
@bors
bors merged commit ae8b84b into rust-lang:masterMay 4, 2021
@rustbotrustbot added this to the 1.54.0 milestone May 4, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 9, 2021
…efids, r=jyn514,GuillaumeGomez
Minimize amount of fake `DefId`s used in rustdoc
Follow up from rust-lang#84707, which minimizes the amount of fake defids to the smallest amount possible. Every `FakeDefId` that is now used in the rustdoc library must be preserved and can not be replaced with a normal `DefId`.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 15, 2021
…efids, r=jyn514,GuillaumeGomez
Minimize amount of fake `DefId`s used in rustdoc
Follow up from rust-lang#84707, which minimizes the amount of fake defids to the smallest amount possible. Every `FakeDefId` that is now used in the rustdoc library must be preserved and can not be replaced with a normal `DefId`.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 15, 2021
…efids, r=jyn514,GuillaumeGomez
Minimize amount of fake `DefId`s used in rustdoc
Follow up from rust-lang#84707, which minimizes the amount of fake defids to the smallest amount possible. Every `FakeDefId` that is now used in the rustdoc library must be preserved and can not be replaced with a normal `DefId`.
pnkfelix added a commit to pnkfelix/rust that referenced this pull request Jun 10, 2021
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this pull request Jun 19, 2021
@Stupremee
Stupremee deleted the remove-fake-defids-in-rustdoc branch June 26, 2021 12:03
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 6, 2021
…mid, r=jyn514
rustdoc: Replace `FakeDefId` with new `ItemId` type
Follow up from rust-lang#84707
`@Manishearth` [suggested](rust-lang#84707 (comment)) that there should be a new `ItemId` type that can distinguish between auto traits, normal ids, and blanket impls instead of using `FakeDefId`s.
This type is introduced by this PR.
There are still some `FIXME`s left, because I was unsure what the best solution for them would be.
Especially the naming in general now is a bit weird right now and needs to be cleaned up. Now there are no "fake" ids so the `is_fake` method on `Item` does not really make sense and maybe the methods on `ItemId` should be renamed too?
Also, we need to represent the new item ids in the JSON backend somehow.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get rid of fake DefIds in rustdoc

10 participants

@Stupremee@rust-log-analyzer@camelid@jyn514@bors@GuillaumeGomez@Manishearth@Aaron1011@rust-highfive@rustbot