rustdoc: add --print option - #151618
Conversation
|
r? @notriddle rustbot has assigned @notriddle. Use |
This comment has been minimized.
This comment has been minimized.
|
I could indeed see the |
I'd like to @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
| (option_env!("CFG_COMPILER_HOST_TRIPLE")).expect("CFG_COMPILER_HOST_TRIPLE") | ||
| env!("CFG_COMPILER_HOST_TRIPLE") |
There was a problem hiding this comment.
That was changed from env! to option_env! in the first commit of #13724, but not sure why this change was made or if it's still relevant as CI is green.
(Was looking looking for a #[expect] reason as removing the extra parentheses triggers deny-by-default clippy::option_env_unwrap)
This comment has been minimized.
This comment has been minimized.
|
@ShE3py still interested in driving this PR forward? |
|
Yup, prolly next month when I have time. |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| // -W help | ||
| if sess.opts.describe_lints { | ||
| rustc_driver::describe_lints(sess, registered_lints); | ||
| return Ok(None); | ||
| } |
There was a problem hiding this comment.
Fixes -W help when running doctests:
$ rustdoc +nightly -Whelp --test /dev/null
error: couldn't find file ``
There was a problem hiding this comment.
Copied from tests/run-make/print-crate-root-lint-levels/, replaced unexpected_cfgs with rustdoc::private_doc_tests.
|
I have grouped the I can somewhat far-fetch someone using For Markdown files and doctests, @rustbot review |
This comment has been minimized.
This comment has been minimized.
rustdoc: add `--print` option try-job: test-various try-job: x86_64-msvc-*
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 8facfe3 failed: CI. Failed job:
|
|
Added ignore directives based on another doctest test: rust/tests/run-make/rustdoc/doctest/test-builder/rmake.rs Lines 26 to 34 in 3cabe36 @bors try jobs=test-various,armhf-gnu |
This comment has been minimized.
This comment has been minimized.
rustdoc: add `--print` option try-job: test-various try-job: armhf-gnu
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 6508b6f failed: CI. Failed job:
|
341679a to
bf27a5a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Unknown argument "armhf-gnu". Did you mean to use |
|
@bors try jobs=armhf-gnu |
This comment has been minimized.
This comment has been minimized.
rustdoc: add `--print` option try-job: armhf-gnu
|
@bors r=notriddle |
rustdoc: add `--print` option Context: `--print crate-root-lint-levels` (rust-lang#139180) is only available for `rustc` and `clippy-driver`, while it would make sense for it to also be available for `rustdoc` (à la rust-lang#83895.) Not too sure about the stability of `rustdoc --print=any` or if this needs a MCP; strictly speaking, only `rustdoc +nightly -Z unstable-options --print=crate-root-lint-levels` would be required (and the `rustdoc --print` would be stabilized together with `crate-root-lint-levels`), but I guess that makes sense to have all the `--print`s for consistency. For regression tests, not sure if ui or run-make is preferable, as run-make would need some sort of trait to avoid duplicating code between `rustc()` and `rustdoc()` (or just test `rustdoc` as it delegates to `rustc`): https://github.com/rust-lang/rust/blob/021fc25b7a48f6051bee1e1f06c7a277e4de1cc9/tests/run-make/print-crate-root-lint-levels/rmake.rs#L82-L88 @rustbot label +A-CLI +A-print-requests
rustdoc: add `--print` option Context: `--print crate-root-lint-levels` (rust-lang#139180) is only available for `rustc` and `clippy-driver`, while it would make sense for it to also be available for `rustdoc` (à la rust-lang#83895.) Not too sure about the stability of `rustdoc --print=any` or if this needs a MCP; strictly speaking, only `rustdoc +nightly -Z unstable-options --print=crate-root-lint-levels` would be required (and the `rustdoc --print` would be stabilized together with `crate-root-lint-levels`), but I guess that makes sense to have all the `--print`s for consistency. For regression tests, not sure if ui or run-make is preferable, as run-make would need some sort of trait to avoid duplicating code between `rustc()` and `rustdoc()` (or just test `rustdoc` as it delegates to `rustc`): https://github.com/rust-lang/rust/blob/021fc25b7a48f6051bee1e1f06c7a277e4de1cc9/tests/run-make/print-crate-root-lint-levels/rmake.rs#L82-L88 @rustbot label +A-CLI +A-print-requests
…uwer Rollup of 11 pull requests Successful merges: - #151618 (rustdoc: add `--print` option) - #161287 (Update `icu_list` dependency to 2.3) - #161767 (change DEFAULT_STACK_SIZE to be 32MB on s390x) - #161968 (Diverse offload fixes) - #161971 (Remove -Zsaturating-float-casts flag) - #162071 (Fix ICE of getting item name from RPITIT) - #161209 (Rework `next_power_of_two` to always be `1 << …`) - #162073 (Change some `Infallible` to `!` in std) - #162086 (Remove `gate_check` from `AttributeStability::Unstable`) - #162102 (`alloc` crate: shrink undocumented `unsafe` blocks) - #162110 (make it clear that Range cannot represent arbitrary ranges)
Rollup merge of #151618 - ShE3py:rustdoc-print, r=notriddle rustdoc: add `--print` option Context: `--print crate-root-lint-levels` (#139180) is only available for `rustc` and `clippy-driver`, while it would make sense for it to also be available for `rustdoc` (à la #83895.) Not too sure about the stability of `rustdoc --print=any` or if this needs a MCP; strictly speaking, only `rustdoc +nightly -Z unstable-options --print=crate-root-lint-levels` would be required (and the `rustdoc --print` would be stabilized together with `crate-root-lint-levels`), but I guess that makes sense to have all the `--print`s for consistency. For regression tests, not sure if ui or run-make is preferable, as run-make would need some sort of trait to avoid duplicating code between `rustc()` and `rustdoc()` (or just test `rustdoc` as it delegates to `rustc`): https://github.com/rust-lang/rust/blob/021fc25b7a48f6051bee1e1f06c7a277e4de1cc9/tests/run-make/print-crate-root-lint-levels/rmake.rs#L82-L88 @rustbot label +A-CLI +A-print-requests
View all comments
Context:
--print crate-root-lint-levels(#139180) is only available forrustcandclippy-driver, while it would make sense for it to also be available forrustdoc(à la #83895.)Not too sure about the stability of
rustdoc --print=anyor if this needs a MCP; strictly speaking, onlyrustdoc +nightly -Z unstable-options --print=crate-root-lint-levelswould be required (and therustdoc --printwould be stabilized together withcrate-root-lint-levels), but I guess that makes sense to have all the--prints for consistency.For regression tests, not sure if ui or run-make is preferable, as run-make would need some sort of trait to avoid duplicating code between
rustc()andrustdoc()(or just testrustdocas it delegates torustc):rust/tests/run-make/print-crate-root-lint-levels/rmake.rs
Lines 82 to 88 in 021fc25
@rustbot label +A-CLI +A-print-requests