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

Search bar not working with cargo doc --open #70781

Closed
icy-ux opened this issue Apr 4, 2020 · 9 comments
Closed

Search bar not working with cargo doc --open #70781

icy-ux opened this issue Apr 4, 2020 · 9 comments
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@icy-ux
Copy link

icy-ux commented Apr 4, 2020

Problem
The search bar isn't working when I do cargo doc --open using Firefox. Normally I can type in method or struct name in the search bar at the top, and it will search the libraries associated with the project (as well as the project) and return links to appropriate documentation. Instead, when I click the search bar nothing happens, and I can't type anything in the search bar.

The browser dev tools indicate this is because of a ReferenceError: E is not defined in the javascript in target/doc/search-index.js:16

This does not happen with every project. A test project created with very few dependencies resulted the search bar working fine, and I haven't been able to determine whether it is a particular dependency which is causing the problem

Steps

  1. Execute cargo doc --open
  2. Switch to the (newly-opened) Firefox window
  3. Try to use the search bar

Possible Solution(s)
Unknown

Notes

Output of cargo version:

$ cargo version
cargo 1.42.0 (86334295e 2020-01-31)
$ rustup --version
rustup 1.21.1 (7832b2ebe 2019-12-20)
$ rustc --version
rustc 1.42.0 (b8cedc004 2020-03-09)

@ehuss ehuss transferred this issue from rust-lang/cargo Apr 4, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 4, 2020

Transferring to the rust-lang/rust repository, as this is likely a rustdoc issue.

@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 Apr 4, 2020
@jonas-schievink
Copy link
Contributor

Please retry on nightly, it might be fixed there

@icy-ux
Copy link
Author

icy-ux commented Apr 4, 2020 via email

@icy-ux
Copy link
Author

icy-ux commented Apr 12, 2020 via email

@jonas-schievink
Copy link
Contributor

Odd, closing as fixed then

@icy-ux
Copy link
Author

icy-ux commented Apr 12, 2020 via email

@GuillaumeGomez
Copy link
Member

Sorry but unless you provide an error (from the browser console), I'll just assume that there is no bug but maybe an issue specific to your machine. Don't hesitate to re-open it if you have more information!

@ehuss
Copy link
Contributor

ehuss commented May 8, 2020

I just ran into this. A reproduction is to run cargo +1.40.0 doc on a project with some dependencies, and then run cargo doc --no-deps with a version of 1.41 or newer. This causes the search-index.js file to retain the old format (from 1.40) mixed with the new format (presumably from #66828).

@GuillaumeGomez is it intended that shared, persistent files (like search-index.js) are not necessarily compatible between releases? If so, I can probably look at adding something to Cargo to flush the doc/ directory if it detects a different version has been used.

@GuillaumeGomez
Copy link
Member

It's not supposed to be compatible between versions, indeed. Cleaning the doc repository would be a great idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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

4 participants