Skip to content

Local rustdoc search doesn't work with --no-deps #63666

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

Open
Boddlnagg opened this issue Aug 17, 2019 · 7 comments
Open

Local rustdoc search doesn't work with --no-deps #63666

Boddlnagg opened this issue Aug 17, 2019 · 7 comments
Labels
A-rustdoc-search Area: Rustdoc's search feature C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Boddlnagg
Copy link
Contributor

I'm having an issue that is similar to rust-lang/docs.rs#316, but it's about local docs.

I'm using cargo doc --no-deps --open, and on the opened page the search does not work. It shows "Loading search results..." and doesn't complete, just like in the link above.

The JS console says: TypeError: paths is undefined (main.js:95:15458), and in the JS debugger I see the following: It's trying to access rawSearchIndex['byteorder'].p, but rawSearchIndex['byteorder'] does not have p. It looks like the following:

rawSearchIndex['byteorder']: {…}
doc: "This crate provides convenience methods for encoding and decoding numbers in either [big-endian or little-endian order]."
items: (265) […]
paths: (5) […]
<prototype>: {…}

However, for my own crate it works correctly:

rawSearchIndex['climeta']: {…}
doc: ""
i: (2184) […]
p: (143) […]
<prototype>: {…}

Actually I guess there should be nothing about byteorder at all in the index, because I built the docs with --no-deps, and alas, when building without --no-deps, the search works!

Now, I tried to build again with --no-deps, and it still works. Apparently it was trying to load some old index file that had an outdated format ...

It's great when a problem gets solved while writing the issue report 😆, but I think this issue might still serve a purpose, so I'll open it anyway, if only for others to find it. And maybe rustdoc should try harder to not load outdated index files.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 17, 2019
@Boddlnagg
Copy link
Contributor Author

And now I noticed: When I build with --no-deps after having built without --no-deps, the other crates are still shown in the docs and found via the index, but I want to see only my own crate ... do I have to delete the target/doc directory?

@GuillaumeGomez
Copy link
Member

Yes, when generating docs, rustdoc look at the target directory and changes a few things depending on what it finds. To go back on your original issue, I think it'll fail again if you remove the folder and regenerate with --no-deps. I'll assign myself on it.

@GuillaumeGomez GuillaumeGomez self-assigned this Sep 2, 2019
@jyn514 jyn514 changed the title Local rustdoc search doesn't work Local rustdoc search doesn't work with --no-deps Aug 25, 2020
@jyn514 jyn514 added the A-rustdoc-search Area: Rustdoc's search feature label Nov 4, 2020
@lolbinarycat
Copy link
Contributor

triage: seems fixed

@GuillaumeGomez
Copy link
Member

Please don't close issues if there is no regression test.

@lolbinarycat
Copy link
Contributor

is there a label for "fixed, but has no regression test"?

@GuillaumeGomez
Copy link
Member

Not that I know of.

@lolbinarycat lolbinarycat added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Sep 19, 2024
@lolbinarycat
Copy link
Contributor

found it.

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 C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants