-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 [src] hyperlinks in rustdoc #23213
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -1,4 +1,4 @@ | |||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT | |||
// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT |
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.
We've basically agreed to stop touching these. They're legal cargo-culting.
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.
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.
Fair enough.
Would it be possible to write a regression test for this? |
🎊 |
@ipetkov if you're not familiar with rustdoc integration/regression testing, look in the You might want to check that a |
@tomjakubowski Are you interested in being the unofficial-official reviewer for this? You're the most active in this codebase recently. |
@tomjakubowski I wasn't until today, but it seemed pretty straight forward :) Also the PR has been updated to include a regression test |
@ipetkov looks good to me, but I'd prefer if this regression had its own test. I'm also a little bit curious why this bug only cropped up recently. Generating |
@tomjakubowski I'm really not sure what caused the breakage, though I have a feeling it might be related with reforming @gankro @tomjakubowski I've updated the PR so that the regression tests are in their own test rather than in Sorry for the delay at updating this, my machine suffered from a hardware failure a few nights ago and I haven't had access to my files. I haven't tested (or built) these new updates, though I tried to double check the test cases, and hopefully the build will pass. |
@@ -695,13 +695,18 @@ fn shortty(item: &clean::Item) -> ItemType { | |||
/// static HTML tree. | |||
// FIXME (#9639): The closure should deal with &[u8] instead of &str | |||
// FIXME (#9639): This is too conservative, rejecting non-UTF-8 paths | |||
fn clean_srcpath<F>(src_root: &Path, p: &Path, mut f: F) where | |||
fn clean_srcpath<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F) where |
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.
Could you add a brief mention of what keep_filename
does to the docs?
@huonw Updated with docs! |
@bors r+ |
📌 Commit cc27f29 has been approved by |
⌛ Testing commit cc27f29 with merge 8165036... |
Test breaks on a mac? http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4122/steps/test/logs/stdio
|
⛄ The build was interrupted to prioritize another pull request. |
⌛ Testing commit cc27f29 with merge a30341f... |
⛄ The build was interrupted to prioritize another pull request. |
* rustdoc was doubly appending the file name to the path of where to generate the source files, meanwhile, the [src] hyperlinks were not * Added a flag to rustdoc::html::render::clean_srcpath to ignore the last path component, i.e. the file name itself to prevent the issue * This also avoids creating directories with the same name as source files, and it makes sure the link to `main.css` is correct as well. * Added regression tests to ensure the rustdoc heirarchy of rendered source files remains consistent Fixes #23192
⌛ Testing commit cc27f29 with merge 10d5cdf... |
@huonw @Manishearth d'oh copy paste error in a test file. I was able to test a fix locally and the update should fix things now! |
@bors: r=huonw |
📌 Commit af6cf85 has been approved by |
* rustdoc was doubly appending the file name to the path of where to generate the source files, meanwhile, the [src] hyperlinks were not * Added a flag to rustdoc::html::render::clean_srcpath to ignore the last path component, i.e. the file name itself to prevent the issue * This also avoids creating directories with the same name as source files, and it makes sure the link to `main.css` is correct as well. Fixes #23192
generate the source files, meanwhile, the [src] hyperlinks were not
last path component, i.e. the file name itself to prevent the issue
files, and it makes sure the link to
main.css
is correct as well.Fixes #23192