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

Refactor rustdoc #52257

Merged
merged 2 commits into from
Jul 25, 2018
Merged

Refactor rustdoc #52257

merged 2 commits into from
Jul 25, 2018

Conversation

steveklabnik
Copy link
Member

@steveklabnik steveklabnik commented Jul 11, 2018

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 11, 2018
Copy link
Member

@QuietMisdreavus QuietMisdreavus left a 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.

.position(|&(p, ..)| {
p == *pass
}) {
Some(i) => passes::PASSES[i].1,
*/
Copy link
Member

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?

Copy link
Member Author

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. :)

[lib]
name = "rustdoc"
path = "lib.rs"

Copy link
Member

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?

Copy link
Member Author

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 ;)

Copy link
Member

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.

Copy link
Member

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).

Copy link
Member

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.

@QuietMisdreavus
Copy link
Member

Also, the removal of PluginResult clashes with #52211, though moving everything into an inner src directory clashes with literally every open rustdoc PR, so pick your poison.

eprintln!("WARNING: --plugins no longer functions; see CVE-2018-1000622");
}

if !plugin_path.is_none() {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, my bad!

eprintln!("WARNING: --plugin-path no longer functions; see CVE-2018-1000622");
}

info!("Executing passes");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this add?

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry! Damn diff...

None => {
error!("unknown pass {}, skipping", *pass);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding this line?

Copy link
Member Author

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.

@bjorn3 bjorn3 mentioned this pull request Jul 13, 2018
@QuietMisdreavus
Copy link
Member

@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.

@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 23, 2018
@steveklabnik
Copy link
Member Author

Rebased and removed the zombie code :)

Copy link
Member

@QuietMisdreavus QuietMisdreavus left a 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.

[lib]
name = "rustdoc"
path = "lib.rs"

Copy link
Member

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.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:12:41] travis_fold:end:stage0-rustdoc-themes

[01:12:41] travis_time:end:stage0-rustdoc-themes:start=1532356443941579459,finish=1532356445052331239,duration=1110751780

[01:12:41] thread 'main' panicked at 'read_dir failed: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5
[01:12:41] 
[01:12:41] 
[01:12:41] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/rustdoc-themes" "/checkout/obj/build/bootstrap/debug/rustdoc" "/checkout/src/librustdoc/html/static/themes"
[01:12:41] expected success, got: exit code: 101
[01:12:41] expected success, got: exit code: 101
[01:12:41] 
[01:12:41] 
[01:12:41] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:12:41] Build completed unsuccessfully in 0:31:52
[01:12:42] make: *** [check] Error 1
[01:12:42] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0012b193
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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 @TimNN. (Feature Requests)

@steveklabnik
Copy link
Member Author

especially the code layout change.

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

@QuietMisdreavus
Copy link
Member

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 src/tools/rustdoc/src instead, alongside the stub main.rs that's already there. However, it would be better to do this in a separate PR. I really want to have this pass refactor landed so i can tweak them some more. >_>

@steveklabnik
Copy link
Member Author

Okay, dropped the file moves.

@QuietMisdreavus
Copy link
Member

Thanks so much! I'm calling this good to go!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 24, 2018

📌 Commit 0bf2a06 has been approved by QuietMisdreavus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 24, 2018
@QuietMisdreavus
Copy link
Member

@bors r-

Oops, i guess i should wait on travis first.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 24, 2018
@QuietMisdreavus
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 24, 2018

📌 Commit 0bf2a06 has been approved by QuietMisdreavus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 24, 2018
@bors
Copy link
Contributor

bors commented Jul 24, 2018

⌛ Testing commit 0bf2a06 with merge 46804ef...

bors added a commit that referenced this pull request Jul 24, 2018
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
@bors
Copy link
Contributor

bors commented Jul 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: QuietMisdreavus
Pushing 46804ef to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants