Skip to content
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

Fix primitive retrieval in search index generation #74879

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jul 28, 2020

Part of #60485. Fixes #74780.

Before merging, I have a few questions remaining:

Should we remove the primitive_locations field from the Cache type? If so, we'll have to replace in the few places where we use this field (not really a problem). However, this field includes the primitive types of the current crates, whereas my new implementation only includes the ones coming from external crates. I'm not sure if it'll be an issue for libcore or not (maybe not since they can be retrieved directly inside the crate, no?).

EDIT: I removed the primitive_locations field from the Cache type, so now we're only referring/using the new "primitives cache" added by this PR.

cc @rust-lang/rustdoc

r? @Manishearth

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2020
@ollie27 ollie27 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jul 28, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Should we remove the primitive_locations field from the Cache type?

I think it's better not to duplicate it in multiple places, yeah.

However, this field includes the primitive types of the current crates, whereas my new implementation only includes the ones coming from external crates.

Is that the case? I see that this runs in impl Clean for CrateNum - won't external crates also be cleaned? Or is the ordering wrong and for this to work we need to have all the primitives before finishing the first crate?

src/librustdoc/clean/mod.rs Outdated Show resolved Hide resolved
src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Jul 28, 2020

Oh crap! I forgot to clean up stuff. >< I was too focused on my questions thing...

@GuillaumeGomez GuillaumeGomez force-pushed the fix-primitive-retrieval-in-search-index-generation branch from fc8298d to a80f0a9 Compare July 29, 2020 11:59
@Manishearth
Copy link
Member

Now that this is no longer filling in any fields on clean::ExternalCrate I would like to move its initialization out of clean entirely. Can we write a function that takes tcx, runs cx.tcx.crates().iter().... and populates this struct, and then calls it right before clean::krate()?

Eventually (not in this PR) i'd like to move this and the cache as fields on context objects so that we don't have as many statics.

@jyn514
Copy link
Member

jyn514 commented Jul 29, 2020

---- [rustdoc] rustdoc/tuples.rs stdout ----
status: exit code: 1
 stderr:
------------------------------------------
thread 'rustc' panicked at 'no entry found for key', src/librustdoc/html/format.rs:579:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Looks like the cache might not be populated soon enough?

@Manishearth
Copy link
Member

Yeah that's another reason to just lift it out of clean entirely.

I suspect that bug is because of libcore using primitives in functions and libstd hasn't been cleaned yet.

@bors
Copy link
Contributor

bors commented Jul 30, 2020

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

@GuillaumeGomez GuillaumeGomez force-pushed the fix-primitive-retrieval-in-search-index-generation branch 2 times, most recently from aee02c5 to 81cfe2e Compare July 31, 2020 20:37
@GuillaumeGomez GuillaumeGomez force-pushed the fix-primitive-retrieval-in-search-index-generation branch from 81cfe2e to 374f9b5 Compare July 31, 2020 21:22
@GuillaumeGomez
Copy link
Member Author

I'm completely unable to understand why caching the primitive sooner prevents rustdoc to find primitive types implementations, meaning that for example, it cannot find f32::is_nan. If anyone has an idea...

@bors
Copy link
Contributor

bors commented Aug 4, 2020

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

@crlf0710
Copy link
Member

CI is red and there's merge conflict... And let me try ping @eddyb to see if he's got an idea about the problem here.

@crlf0710 crlf0710 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 Aug 21, 2020
@jyn514 jyn514 added the A-type-based-search Area: Searching rustdoc pages using type signatures label Sep 5, 2020
@crlf0710 crlf0710 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Sep 25, 2020
@Dylan-DPC-zz Dylan-DPC-zz added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2020
@crlf0710 crlf0710 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Oct 23, 2020
@crlf0710 crlf0710 added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Nov 13, 2020
@camelid
Copy link
Member

camelid commented Dec 4, 2020

Are there any updates? It's been 3 months. I know eddyb tends to be very busy, so is there someone else who can help with this?

@camelid camelid added the A-rustdoc-search Area: Rustdoc's search feature label Dec 4, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 4, 2020

This needs someone to put in the time debugging why it's broken.

@GuillaumeGomez do you know if PRIMITIVES has the same contents now as it did before? Like does it contain u8 after you initialize, before you call clean::krate?

@jyn514 jyn514 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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Dec 4, 2020
@GuillaumeGomez
Copy link
Member Author

iirc, it doesn't contain anything. I'll try to get back to this PR soon.

@jyn514
Copy link
Member

jyn514 commented Dec 29, 2020

I'm completely unable to understand why caching the primitive sooner prevents rustdoc to find primitive types implementations, meaning that for example, it cannot find f32::is_nan.

Can you expand on this more? What code is currently responsible for finding those primitive impls?

@GuillaumeGomez
Copy link
Member Author

But "the impl" I meant the source. Apparently, changing the moment when we store them prevents to have access to this information. Also, I don't remember that the primitive types have a special implementation to retrieve this information. However, with all the recent changes, maybe it'll be possible to improve this part too. Like said a month ago, I'll try to get back to this PR some day haha.

@jyn514 jyn514 mentioned this pull request Jan 14, 2021
@crlf0710 crlf0710 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 15, 2021
@GuillaumeGomez
Copy link
Member Author

Replaced by #81557.

@GuillaumeGomez GuillaumeGomez deleted the fix-primitive-retrieval-in-search-index-generation branch January 30, 2021 16:42
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 1, 2021
…ollie27

Fix primitive search in parameters and returned values

Part of rust-lang#60485.
Fixes rust-lang#74780.

Replacing rust-lang#74879.

cc `@camelid` `@jyn514` `@CraftSpider`
r? `@ollie27`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2021
…lie27

Fix primitive search in parameters and returned values

Part of rust-lang#60485.
Fixes rust-lang#74780.

Replacing rust-lang#74879.

cc `@camelid` `@jyn514` `@CraftSpider`
r? `@ollie27`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature A-type-based-search Area: Searching rustdoc pages using type signatures S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant 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.

Type-based search does not work for primitives since March
9 participants