-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[rustdoc] Remove old style files #56577
[rustdoc] Remove old style files #56577
Conversation
Based on the discussion in #35705 i really doubt we should be getting rid of the redirect pages. cc @rust-lang/rustdoc |
I don't think there's much reason to remove the macro redirects as I don't think many crates have that many macros and we don't want to break existing links. The other redirects aren't old, they're a new style added by #35236. To remove them we would need to update anything generating links of that style like https://github.com/rust-dev-tools/rls-analysis/blob/1e0812e8595b16c086ce9a400b9a50adaf82914b/src/lib.rs#L504-L561. cc. @nrc |
They're both useless and take space for nothing. :-/ |
I greatly appreciate any reduction in the number of files produced by rustdoc. Killing off redirects will substantially improve doc generation time for |
This is not true, they allow linking to rustdoc from tools outside the compiler. Some ways to remove them:
|
@nrc: what tools are using these redirects and how hard would it be for them to generate links using the current URL scheme instead? |
RLS, cargo-src, maybe some other stuff
impossible. Basically nobody knows about the |
What about I add a flag that'll be disabled by default in order to have those files generated? |
As long as the files are there on the hosted rustdoc and docs.rs instances, that seems fine |
Ok, I'll do it tomorrow. |
a98637c
to
270515d
Compare
I added the option (as stable, if that's an issue, I'll move it as unstable, but considering it allows to generate files that were already here...). |
Would it be better to have "redirect" in the name of the flag? |
I'm open to changing the name of the flag. No preference on this side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions.
We'll need to remember to coordinate this with docs.rs when this is merged.
src/test/rustdoc/issue-19190.rs
Outdated
@@ -23,9 +23,6 @@ impl Deref for Bar { | |||
fn deref(&self) -> &Foo { loop {} } | |||
} | |||
|
|||
// @has issue_19190/Bar.t.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should either include a test that uses the flag or add it to existing tests that check for these pages.
// compile-flags:--generate-redirect-pages
src/test/rustdoc/issue-19190.rs
Outdated
// @has issue_19190/struct.Bar.html | ||
// @has - '//*[@id="foo.v"]' 'fn foo(&self)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR doesn't delete the legacy HTML IDs, does it? Why did you remove it from all these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went a bit too strongly on the tests haha.
src/test/rustdoc/old-style-files.rs
Outdated
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![crate_name = "foo"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to rename this test file if you change the name of the flag.
270515d
to
93ac41f
Compare
Updated. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
93ac41f
to
56b0bd5
Compare
src/test/rustdoc/issue-35169-2.rs
Outdated
// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' | ||
// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test still should be checking for the HTML IDs.
src/test/rustdoc/issue-35169.rs
Outdated
// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' | ||
// @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
src/test/rustdoc/structfields.rs
Outdated
@@ -8,8 +8,6 @@ | |||
// option. This file may not be copied, modified, or distributed | |||
// except according to those terms. | |||
|
|||
// @has structfields/Foo.t.html | |||
// @has - struct.Foo.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this one actually checks the content of the redirect pages (and these lines were added in the PR that added the redirect pages in the first place) i feel like this test should also keep them.
There's one more place where redirect pages are emitted that you aren't covering in the current PR: |
d44f38f
to
56b0bd5
Compare
I take back my last comment. After looking through the code where that's called, it turns out that those redirects are used by rustdoc itself: When an item is defined privately but re-exported publicly, its "canonical" location is still the private one. So any links that get generated to it point to the "private" location in the hierarchy, which are then redirected to the location in My other outstanding review comments still stand though. |
56b0bd5
to
3d339f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the last force-push, looks like we're good to go!
@bors r+ |
📌 Commit 3d339f2 has been approved by |
I don't agree with the macro redirects being controlled by the same flag as the tool redirects. The macro redirects are there for backward compatibility and I'm not aware of any crates with so many macros that their generation is causing problems. If the tool redirects are only to be used on documentation uploaded to Also, doesn't stabilising a new command line option require documentation in the rustdoc book and a FCP? |
@bors r- I keep forgetting about the process. I'd forgotten that the flag was insta-stable and forgot about needing documentation for it. The suggestion about being perma-unstable is interesting - @nrc do you know if the tool redirects will be needed for local documentation? If they're not, then it's worth never stabilizing it. |
☔ The latest upstream changes (presumably #57063) made this pull request unmergeable. Please resolve the merge conflicts. |
ping from triage @QuietMisdreavus @GuillaumeGomez any updates on this |
I need to add a few things. |
Ping from triage! It looks like this PR hasn't made any progress in a while, so I'm closing it as inactive, per our guidelines. Thanks for your contributions, @GuillaumeGomez, and please feel free to re-open in the future. |
…tyle-files, r=ollie27 Rustdoc remove old style files Reopening of rust-lang#56577 (which I can't seem to reopen...). I made the flag unstable so with this change, what was blocking the PR is now gone I assume.
…tyle-files, r=ollie27 Rustdoc remove old style files Reopening of rust-lang#56577 (which I can't seem to reopen...). I made the flag unstable so with this change, what was blocking the PR is now gone I assume.
r? @QuietMisdreavus