-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Refactor rustdoc #52257
Refactor rustdoc #52257
Conversation
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.
(extremely over-dramatic voice) Expunge all traces of its foul legacy, make sure there is no memory left to honor!
...but first, a couple comments.
src/librustdoc/src/lib.rs
Outdated
.position(|&(p, ..)| { | ||
p == *pass | ||
}) { | ||
Some(i) => passes::PASSES[i].1, | ||
*/ |
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 can probably scrap this zombie code, yeah?
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.
Ugh, yes, I meant to and forgot. :)
src/librustdoc/Cargo.toml
Outdated
[lib] | ||
name = "rustdoc" | ||
path = "lib.rs" | ||
|
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.
Why move all the files into an inner src
directory? Does anything else in-tree do this?
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.
Because it's the default.
Does anything else in-tree do this?
I'm not sure, but I'm of the opinion it should ;)
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.
If it weren't for the error index generator using bits of librustdoc, we may be able to get away with moving all this code into src/tools/rustdoc
, where this pattern would definitely fit in. As-is, nothing else directly in src/
is structured like this. I'm personally indifferent to the change, but it's going to break (and be broken by) every rustdoc PR. (And several people seem interested in cleaning up rustdoc right now...)
Heck, we could possibly get away with it anyway, since a Cargo project can have both a lib and a bin. We'd just need to point bootstrap and the error index generator (and anything else that may point at librustdoc directly) at the new folder.
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 think it's better to keep it. At least some tests rely on it (like error index rendering iirc).
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.
If we're moving all the source files we should at least rename librustdoc
to just rustdoc
.
Also, the removal of |
src/librustdoc/src/lib.rs
Outdated
eprintln!("WARNING: --plugins no longer functions; see CVE-2018-1000622"); | ||
} | ||
|
||
if !plugin_path.is_none() { |
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 is printing the sale as the previous if
condition, could you merge the both please?
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.
They don't; the name of the command is in the warning.
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.
Good point, my bad!
src/librustdoc/src/lib.rs
Outdated
eprintln!("WARNING: --plugin-path no longer functions; see CVE-2018-1000622"); | ||
} | ||
|
||
info!("Executing passes"); |
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.
Why this add?
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.
It wasn't added; it was in the old code. It used to say passes/plugins
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.
Oh sorry! Damn diff...
src/librustdoc/src/lib.rs
Outdated
None => { | ||
error!("unknown pass {}, skipping", *pass); | ||
|
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.
Why adding this line?
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.
Oh, this is just how I'd write it. I find the former cramped.
@steveklabnik With #52194 merged, can you rebase this PR? I'd like to get this in so i can try to rework the passes system. |
d8a4f42
to
efaac8c
Compare
Rebased and removed the zombie code :) |
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.
Thanks for cleaning this up! I'm mostly okay with this now, but i want @GuillaumeGomez and/or @ollie27 to sign off on this too, especially the code layout change.
src/librustdoc/Cargo.toml
Outdated
[lib] | ||
name = "rustdoc" | ||
path = "lib.rs" | ||
|
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.
If it weren't for the error index generator using bits of librustdoc, we may be able to get away with moving all this code into src/tools/rustdoc
, where this pattern would definitely fit in. As-is, nothing else directly in src/
is structured like this. I'm personally indifferent to the change, but it's going to break (and be broken by) every rustdoc PR. (And several people seem interested in cleaning up rustdoc right now...)
Heck, we could possibly get away with it anyway, since a Cargo project can have both a lib and a bin. We'd just need to point bootstrap and the error index generator (and anything else that may point at librustdoc directly) at the new folder.
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 |
yeah, I mean I guess you'd want to do the whole compiler at once, so if yinz hate that change, I'm happy to remove it. It's always felt off to me, but I can also understand consistency within the compiler itself |
I asked @GuillaumeGomez on discord about the way this moves the source files, and he disagreed with it. We talked more about it, and i think it would be better to instead move the files into |
efaac8c
to
ac35901
Compare
ac35901
to
0bf2a06
Compare
Okay, dropped the file moves. |
Thanks so much! I'm calling this good to go! @bors r+ |
📌 Commit 0bf2a06 has been approved by |
@bors r- Oops, i guess i should wait on travis first. |
@bors r+ |
📌 Commit 0bf2a06 has been approved by |
Refactor rustdoc This is based on #52194 and so shouldn't be merged until it gets merged. Now that plugin functionality has been removed, let's kill PluginManager. Additionally, rustdoc now follows the standard cargo layout instead of dumping everything at the top level. r? @rust-lang/rustdoc
☀️ Test successful - status-appveyor, status-travis |
This is based on #52194 and so shouldn't be merged until it gets merged.
Now that plugin functionality has been removed, let's kill PluginManager. Additionally, rustdoc now follows the standard cargo layout instead of dumping everything at the top level.
r? @rust-lang/rustdoc