Skip to content

rustdoc: dep-info for standalone markdown inputs#154352

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
notriddle:emit-md
Apr 14, 2026
Merged

rustdoc: dep-info for standalone markdown inputs#154352
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
notriddle:emit-md

Conversation

@notriddle
Copy link
Copy Markdown
Contributor

@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 Mar 25, 2026
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, that's very nice! There are still parts of the diff I need to carefully review which I'll do later.

View changes since this review

Comment thread src/librustdoc/lib.rs
Comment thread src/librustdoc/lib.rs
if has_dep_info {
// Register the loaded external files in the source map so they show up in depinfo.
// We can't load them via the source map because it gets created after we process the options.
for external_path in &loaded_paths {
Copy link
Copy Markdown
Member

@fmease fmease Mar 29, 2026

Choose a reason for hiding this comment

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

Flags like --theme and --extend-css don't seem to be used for standalone markdown files IINM, so they don't really need to be included in the dep-info. Of course, impl'ing that isn't worth the complexity, this approach is fine as is imo.

let mut md_opts = opt.clone();
md_opts.output = cx.dst.clone();
md_opts.external_html = cx.shared.layout.external_html.clone();
let file = try_err!(cx.sess().source_map().load_file(&index_page), &index_page);
Copy link
Copy Markdown
Member

@fmease fmease Mar 29, 2026

Choose a reason for hiding this comment

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

I have tested your patch locally and ran rustdoc test.md --index-page my-index-page.md --emit=dep-info (with the appropriate source files) but my-index-page.md wasn't listed in the resulting dep info (for comparison, --html-after-content did obv work as the tests also confirm); I might've overlooked something tho.

Note that the custom index page isn't properly tracked in "normal mode" either (where the source file is Rust), neither on main nor on your branch AFAICT.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see.

I notice that write_dep_info is run before the renderer is run. To fix this, I either need to add the file to the source map separately (which can be done the same way --html-before-content and related options are done), or move when the renderer runs.

The less risky option, at least in the short term, is adding the file separately.

@rust-log-analyzer

This comment has been minimized.

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! @bors r+ rollup

The whole initialization & CLI parsing code needs to be overhauled at some point, some things are way too intertwined...

View changes since this review

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 13, 2026

📌 Commit bfaf027 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 13, 2026
rust-bors bot pushed a commit that referenced this pull request Apr 14, 2026
Rollup of 5 pull requests

Successful merges:

 - #149357 (Implement `-Z allow-partial-mitigations` (RFC 3855))
 - #154939 (Refactor: simplify report_selection_error)
 - #152688 (Trait aliases: Also imply default trait bounds on type params other than `Self`)
 - #154352 (rustdoc: dep-info for standalone markdown inputs)
 - #155195 (tidy: handle `#[cfg_attr(bootstrap, doc = "...")]` in `compiler/` comments)
@rust-bors rust-bors bot merged commit 4691e61 into rust-lang:main Apr 14, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 14, 2026
rust-timer added a commit that referenced this pull request Apr 14, 2026
Rollup merge of #154352 - notriddle:emit-md, r=fmease

rustdoc: dep-info for standalone markdown inputs

Part of #146220 (comment)

r? @fmease
@notriddle notriddle deleted the emit-md branch April 14, 2026 15:40
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.

4 participants