Skip to content

rustdoc: fix a few spots where emit isn't respected#155374

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
notriddle:non-static-dep-info
Apr 22, 2026
Merged

rustdoc: fix a few spots where emit isn't respected#155374
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
notriddle:non-static-dep-info

Conversation

@notriddle
Copy link
Copy Markdown
Contributor

@notriddle notriddle commented Apr 16, 2026

Addresses the third list item of #155298

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Apr 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 72 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

Comment thread src/librustdoc/html/render/write_shared.rs Outdated
@notriddle notriddle force-pushed the non-static-dep-info branch from d8cecac to 0731fa8 Compare April 16, 2026 03:37
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Copy Markdown
Contributor

r? @fmease

@rustbot rustbot assigned fmease and unassigned petrochenkov Apr 16, 2026
@notriddle notriddle force-pushed the non-static-dep-info branch from 0731fa8 to f9545cb Compare April 18, 2026 05:13
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

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.

@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the non-static-dep-info branch from f9545cb to d38b3c5 Compare April 18, 2026 05:58
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the non-static-dep-info branch from d38b3c5 to de48fc6 Compare April 18, 2026 15:46
Copy link
Copy Markdown
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

Thanks! I've updated the PR description since it doesn't fully fix #155298; list item (2) doesn't get addressed.

@bors r+ rollup

View changes since this review

if matches!(theme.as_str(), "light" | "dark" | "ayu") {
continue;
}
if opt.emit.is_empty() || opt.emit.contains(&EmitType::HtmlNonStaticFiles) {
Copy link
Copy Markdown
Member

@fmease fmease Apr 22, 2026

Choose a reason for hiding this comment

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

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.

opt.emit could be a bitset even to avoid having to allocate 2×EmitType in the common case (peanuts ofc) (won't work because 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.

Copy link
Copy Markdown
Member

@fmease fmease Apr 23, 2026

Choose a reason for hiding this comment

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

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.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 22, 2026

📌 Commit de48fc6 has been approved by fmease

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 22, 2026
…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)
@rust-bors rust-bors Bot merged commit dcde112 into rust-lang:main Apr 22, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 22, 2026
rust-timer added a commit that referenced this pull request Apr 22, 2026
Rollup merge of #155374 - notriddle:non-static-dep-info, r=fmease

rustdoc: fix a few spots where emit isn't respected

Addresses the third list item of #155298
@notriddle notriddle deleted the non-static-dep-info branch April 23, 2026 02:14
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 24, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants