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

Document clippy on nightly-rustc #90354

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

xFrednet
Copy link
Member

@xFrednet xFrednet commented Oct 27, 2021

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds clippy_utils to the documentation. I've decided to only document one crate for now, as clippy_lints etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

./x.py --stage 1 doc src/tools/clippy if working fine now after the help that @jyn514 and @ehuss have provided. A big THANK YOU to them!

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 27, 2021
@rust-log-analyzer

This comment has been minimized.

@xFrednet xFrednet force-pushed the 00000-lets-deploy-clippy-docs branch from 1d20487 to 17350f8 Compare October 27, 2021 20:58
@jyn514
Copy link
Member

jyn514 commented Oct 27, 2021

@xFrednet doc --stage 0 doesn't work for the compiler or compiler tools, I expect the error is unrelated to your change. Try x.py doc --stage 1 src/tools/clippy.

@xFrednet
Copy link
Member Author

xFrednet commented Oct 27, 2021

@jyn514 Thanks, that did the trick, well got me a bit further. Now it's complaining, that it can't find std and core. (The same happens for rustfmt)

error[E0463]: can't find crate for `std`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `serde_derive` due to previous error
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`

error: build failed


command did not execute successfully: ".../build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "doc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--manifest-path" ".../src/tools/clippy/Cargo.toml" "-Zskip-rustdoc-fingerprint" "--no-deps" "-p" "clippy_lints" "-p" "clippy_utils"
expected success, got: exit status: 101

The executed command is already looking good IMO :)

@ehuss
Copy link
Contributor

ehuss commented Oct 28, 2021

Looks like a bug in x.py. When documenting a single tool, you need to have compiler-docs = true in config.toml. Otherwise documenting rustc is skipped, and the tools generally require that step to be performed.

The was_invoked_explicitly call here should probably be removed.

@xFrednet xFrednet force-pushed the 00000-lets-deploy-clippy-docs branch from 17350f8 to 01e441f Compare October 28, 2021 09:35
@xFrednet
Copy link
Member Author

Thank you @ehuss, that did the trick! Everything seems to be working now!

@jyn514
Copy link
Member

jyn514 commented Oct 28, 2021

compiler_docs has always seemed weird to me anyway - rather than a hard on or off switch, could we change it so it only affects the default? So compiler_docs = false means x.py doc won't document rustc, but x.py doc compiler/rustc will. That should fix the CI failure as well and let you remove explicitly_invoked altogether.

@apiraino apiraino added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label Oct 28, 2021
@Mark-Simulacrum
Copy link
Member

Hm, so the PR discussion seems to indicate that the was_explicitly_invoked call should be removed, but I do not see that in the diff. Did it perhaps forget to get pushed?

FWIW, I don't think that's quite the right fix. The exact way we do defaults here is a bit iffy, as @jyn514 mentions, and we don't have a great story around it, but just dropping the was-explicitly-invoked will break compiler-docs=false builds. I think the appropriate fix is a little more expansive:

  • Gate tool doc builds on compiler-docs = true by default (i.e., add a default_condition(run.builder.config.compiler_docs) to the should_run method generated by the macro). They are all generating what is essentially compiler-docs anyway, so this makes sense IMO.
  • Modify the default_condition on doc::Rustc to use compiler_docs, not regular docs.
  • Remove the gate in doc::Rustc which checks for compiler-docs being enabled as well as the was_explicitly_invoked call, it's no longer needed, as we shouldn't reach that code unless (a) we've enabled compiler-docs or (b) some tool or rustc were explicitly invoked.

@Mark-Simulacrum Mark-Simulacrum 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 Nov 1, 2021
@xFrednet
Copy link
Member Author

xFrednet commented Nov 1, 2021

Hm, so the PR discussion seems to indicate that the was_explicitly_invoked call should be removed, but I do not see that in the diff. Did it perhaps forget to get pushed?

My intention with this PR was only to add Clippy to the nightly-rustc docs. I was at first unable to test the doc building locally due to some missing knowledge, which lead to the PR discussion.

I haven't really looked at the inner workings of the bootstrapping and docs building process. Most of the things you mentioned is new territory for me. I can try my hand on it with some guidance if you'd like. @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

So this PR works as-is today?

@xFrednet
Copy link
Member Author

xFrednet commented Nov 1, 2021

Yes! I can locally build the documentation, and it includes the clippy_utils crate.

I only needed help to figure out the comment and changes to the config.toml to do so. The complexity of this process was the starter of the discussion about how this could be improved and what causes it :)

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

Ok, seems good enough for now then.

@bors
Copy link
Contributor

bors commented Nov 1, 2021

📌 Commit 01e441f has been approved by Mark-Simulacrum

@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 Nov 1, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 1, 2021
…ocs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that ``@jyn514`` and ``@ehuss`` have provided. A big THANK YOU to them!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 1, 2021
…ocs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that ```@jyn514``` and ```@ehuss``` have provided. A big THANK YOU to them!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 2, 2021
…ocs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that ````@jyn514```` and ````@ehuss```` have provided. A big THANK YOU to them!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 2, 2021
…ocs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that `````@jyn514````` and `````@ehuss````` have provided. A big THANK YOU to them!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 2, 2021
…ocs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bd. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that ``````@jyn514`````` and ``````@ehuss`````` have provided. A big THANK YOU to them!
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 3, 2021
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#90084 (Make printed message match the code comment)
 - rust-lang#90354 (Document clippy on nightly-rustc)
 - rust-lang#90417 (stabilize `relaxed_struct_unsize`)
 - rust-lang#90472 (Clarify what to do with accepted feature gates)
 - rust-lang#90500 (Update Clippy dependencies)
 - rust-lang#90502 (Split doc_cfg and doc_auto_cfg features)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 40f01aa into rust-lang:master Nov 3, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 3, 2021
@xFrednet xFrednet deleted the 00000-lets-deploy-clippy-docs branch November 3, 2021 10:43
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 9, 2021
…crum

Make `compiler-docs` only control the default instead of being a hard off-switch

This also fixes `x doc src/tools/clippy` when compiler-docs is disabled.

See rust-lang#90354 (comment).

r? `@Mark-Simulacrum`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 9, 2021
…crum

Make `compiler-docs` only control the default instead of being a hard off-switch

This also fixes `x doc src/tools/clippy` when compiler-docs is disabled.

See rust-lang#90354 (comment).

r? ``@Mark-Simulacrum``
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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants