Uh oh!
There was an error while loading. Please reload this page.
rustdoc: Call initSidebarItems in root module of crate - #85304
Conversation
9545f7a to
2203840CompareThere was a problem hiding this comment.
I think what we really want here, rather than generating a file with a different name, is to generate a file named sidebar-items.js in the doc root, and unconditionally write a script tag that loads it. So these two if branches would get collapsed into one.
There was a problem hiding this comment.
I'm a little confused... reading the code above this: if the added code works to add a file at the top level, there should already be a sidebar-items.js at the top level.
There was a problem hiding this comment.
the top-level does not mean the top-level of the generated documentation, but is just an alternative name to distinguish between initSidebarItems({}) and initSidebarItems({ /* some items */})
jsha
commented
May 14, 2021
Specifically by "top level" I'm thinking of e.g. https://doc.rust-lang.org/std/. But I'm now realizing there's also a per-module index.html that we need to fix up, and that's what you've fixed up so far. Am I on the right track here? And we need to generate a separate top-level-sidebar-items.js because for the per-module index.html, we specifically don't want to list all the extra stuff that's in the real sidebar-items.js? |
No, the I think the new |
Stupremee
commented
May 14, 2021
I pushed the changes that I meant in my last message. Maybe that helps to understand. |
jsha
commented
May 14, 2021
This is looking good! But when I build locally and visit file:///home/jsha/rust/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html, I get a JS console error: And indeed that file doesn't exist. But |
Does |
Stupremee
commented
May 15, 2021
Apparently, it does. Should the file just be written as an unversichert file or adjust the script tag to include the version? |
It needs the version number if it's a cross-crate shared file (mostly for docs.rs and doc.rust-lang.org purposes). |
Stupremee
commented
May 15, 2021
Ah, that makes sense. Do you think the |
GuillaumeGomez
commented
May 15, 2021
Strangely, your fix looks very different than the one I wrote in 4e22b32 |
jsha
commented
May 15, 2021
I think sidebar-items.js should not have a version number at the crate root, because it doesn't have a version number in other places, and it would confusing. @GuillaumeGomez sorry I didn't realize there was already a fix in progress. I think we should plan on landing this one to fix the regression since it's much smaller. |
jsha
commented
May 15, 2021
Looks good to me in a local test. Thanks for working so quickly to fix. @bors r+ |
bors
commented
May 15, 2021
📌 Commit b8c546862c4277b2a3259f662dda712626c2e9b0 has been approved by |
If it's going to be unversioned, then it needs to be not in the shared files, otherwise docs.rs will have issues if the JS API ever changes. docs.rs can handle unversioned unshared files at the root of the doc-folder now, |
This comment has been minimized.
This comment has been minimized.
jsha
commented
May 15, 2021
@bors r- |
Stupremee
commented
May 15, 2021
Alright. Then I will just revert my last commit! |
b8c5468 to
7c4f3f4CompareStupremee
commented
May 15, 2021
I messed up the rebase. Whoops |
It does not add a new file at every module 🤔 |
Nemo157
commented
May 15, 2021
This approach adds a single new shared file, not even per-crate. This seems by far the simplest minimal change I can see to get backported onto beta to fix it there. It may be possible to simplify it as part of #84834 or other fixes in nightly, but we need to get something that can be backported first. |
GuillaumeGomez
commented
May 15, 2021
I can make #84834 much shorter by only putting back the crate list if you want in another PR. But I'm strongly against adding a new unneeded file. |
Stupremee
commented
May 15, 2021
I can also change this PR to use another fix. I just thought this is an easy way to call the |
GuillaumeGomez
commented
May 15, 2021
@Stupremee: Sorry that you're in the middle of this. :-/ I should have included @jsha on my other PR's discussion, that would have prevented all the problems in here... |
The only way I can see to do this without a new file (or some more major refactoring of how Testing #84834 locally it has an additional change in behaviour that it shows children instead of siblings in the sidebar, that is how it manages to not add a new file because it looks one level deeper on all module's sidebars. |
GuillaumeGomez
commented
May 15, 2021
Yes, this is what I said, I have two changes in my PR. I can extract the fix for the crate listing in another PR to keep the one under debate if you want. |
Stupremee
commented
May 15, 2021
No problem!
That works too and might be the fastest solution. |
Nemo157
commented
May 15, 2021
We discussed on discord and decided to go ahead with this as a first fix. @bors r+ |
bors
commented
May 15, 2021
📌 Commit aaf0ff8 has been approved by |
bors
commented
May 16, 2021
bors
commented
May 16, 2021
☀️ Test successful - checks-actions |
apiraino
commented
May 20, 2021
…ulacrum [beta] backports * Backport 1.52.1 release notes rust-lang#85404 * remove InPlaceIterable marker from Peekable due to unsoundness rust-lang#85340 * rustdoc: Call initSidebarItems in root module of crate rust-lang#85304 * Update LLVM submodule rust-lang#85236 * Do not ICE on invalid const param rust-lang#84913 * Disallows #![feature(no_coverage)] on stable and beta (using standard crate-level gating) rust-lang#84871 * Ensure TLS destructors run before thread joins in SGX rust-lang#84409
r? @jsha
Resolves#85301