rustdoc: fix a few spots where emit isn't respected#155374
rustdoc: fix a few spots where emit isn't respected#155374rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
d8cecac to
0731fa8
Compare
This comment has been minimized.
This comment has been minimized.
|
r? @fmease |
0731fa8 to
f9545cb
Compare
|
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. |
This comment has been minimized.
This comment has been minimized.
f9545cb to
d38b3c5
Compare
This comment has been minimized.
This comment has been minimized.
d38b3c5 to
de48fc6
Compare
| if matches!(theme.as_str(), "light" | "dark" | "ayu") { | ||
| continue; | ||
| } | ||
| if opt.emit.is_empty() || opt.emit.contains(&EmitType::HtmlNonStaticFiles) { |
There was a problem hiding this comment.
If we were to eagerly set opt.emit to [HtmlNonStaticFiles, HtmlStaticFiles] in the CLI parser if --emit wasn't passed, then later stages wouldn't need to know that "absence of emission types means two emission types" & thus wouldn't need to remember to check opt.emit.is_empty(). That'd make fn should_emit_crate unnecessary, too.
(won't work because opt.emit could be a bitset even to avoid having to allocate 2×EmitType in the common case (peanuts ofc)DepInfo has a payload; well SmallVec<_, 2> would do).
Anyway just some thoughts for a potential future cleanup to make all of this more robust.
There was a problem hiding this comment.
While trying to implement my suggestion I realized that I can't just replace the is_empty && contains_html_non_static_files checks under this scheme since the is_empty condition also accounts for "JSON non-static files", e.g., in run_format that's executed by both the HTML & the JSON backend.
I guess we could push a EmitType::EmitJsonNonStaticFiles under output_format == OutputFormat::Json that doesn't necessarily have a corresponding "surface syntax" (so no --emit=json-non-static-files unless we want to). Tho then I'd have to introduce FormatRenderer::NON_STATIC_FILES: EmitType, I guess that's fine.
Alternatively, we could also have a "lower" EmitType that just has EmitNonStaticFiles for Html+Json+Doctests but that seems really overengineered at this point.
Hmm, that makes me question the html- prefix of these options 🤔. I need to reread the meeting messages.
…uwer Rollup of 10 pull requests Successful merges: - #154794 (Add on_unmatch_args) - #155133 (Document precision considerations of `Duration`-float methods) - #154283 (Remove `nodes_in_current_session` field and related assertions) - #155374 (rustdoc: fix a few spots where emit isn't respected) - #155587 (Immediately feed visibility on DefId creation) - #155622 (c-variadic: `va_arg` fixes ) - #155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`) - #155632 (Some metadata cleanups) - #155639 (BinOpAssign always returns unit) - #155647 (rustc-dev-guide subtree update)
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#154794 (Add on_unmatch_args) - rust-lang/rust#155133 (Document precision considerations of `Duration`-float methods) - rust-lang/rust#154283 (Remove `nodes_in_current_session` field and related assertions) - rust-lang/rust#155374 (rustdoc: fix a few spots where emit isn't respected) - rust-lang/rust#155587 (Immediately feed visibility on DefId creation) - rust-lang/rust#155622 (c-variadic: `va_arg` fixes ) - rust-lang/rust#155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`) - rust-lang/rust#155632 (Some metadata cleanups) - rust-lang/rust#155639 (BinOpAssign always returns unit) - rust-lang/rust#155647 (rustc-dev-guide subtree update)
Addresses the third list item of #155298