Skip to content

[rustdoc] Move the creation of IndividualTestOptions into the test runner closure to ensure the temporary folder is removed right after the test is done running - #164202

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:fix-doctest-temp-removal
Oct 12, 2026

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #164145.

Fixes one missed case in #161868: the IndividualTestOptions should have been created directly into the DynTestFn closure so its temporary directory is removed right after it's done running.

r? @RalfJung

@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. labels Oct 12, 2026
@rustbot

rustbot commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@@ -0,0 +1,15 @@

running 1 test

@GuillaumeGomez GuillaumeGomez Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This change is because we used to try to make the temporary directly ahead of the DynTestFn closure when using --persist-doctest, so before the doctest was even running. But it actually doesn't make much sense to have a different behaviour so it's now moved inside the DynTestFn closure and has the same output as when --persist-doctest isn't used.

View changes since the review

Comment thread src/librustdoc/doctest.rs Outdated
Comment on lines 1174 to 1175
doctest_run_fn(
&rustdoc_test_options,

@RalfJung RalfJung Oct 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this means you can change doctest_run_fn mak to taking rustdoc_test_options by-value as it was before my PR.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah indeed, missed that.

@Urgau Urgau left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/// entry.as_ref().unwrap().file_name().to_str().unwrap().starts_with("rustdoctest")
/// })
/// .count();
/// assert_eq!(count, 2);

@RalfJung RalfJung Oct 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is 2 the right number here? Shouldn't it be 1 if the previous test got cleaned up?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We create a first temp dir where we write the rustdoc-cfgs file which contains the list of all args to be passed to the doctests. But I'll write a code comment to explain it.

@theemathas theemathas added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 12, 2026
@GuillaumeGomez
GuillaumeGomez force-pushed the fix-doctest-temp-removal branch from 427c050 to 917a1cb Compare October 12, 2026 10:58
…sure to ensure the temporary folder is removed right after the test is done running
@GuillaumeGomez
GuillaumeGomez force-pushed the fix-doctest-temp-removal branch from 917a1cb to 2cb8b0b Compare October 12, 2026 11:00
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Added the code comment and cleaned up rustdoc code a bit more.

@RalfJung

Copy link
Copy Markdown
Member

LGTM, thanks a lot. :)
@bors r=RalfJung,Urgau

@rust-bors

rust-bors Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2cb8b0b has been tentatively approved by RalfJung,Urgau

It will be put into the queue for this repository once PR CI succeeds.

@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 Oct 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 12, 2026
…moval, r=RalfJung,Urgau

[rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running

Fixes rust-lang#164145.

Fixes one missed case in rust-lang#161868: the `IndividualTestOptions` should have been created directly into the `DynTestFn` closure so its temporary directory is removed right after it's done running.

r? @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 12, 2026
…moval, r=RalfJung,Urgau

[rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running

Fixes rust-lang#164145.

Fixes one missed case in rust-lang#161868: the `IndividualTestOptions` should have been created directly into the `DynTestFn` closure so its temporary directory is removed right after it's done running.

r? @RalfJung
rust-bors Bot pushed a commit that referenced this pull request Oct 12, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #164196 (`rust-analyzer` subtree update)
 - #164037 (Restrict application of optimization attributes from instance)
 - #164201 (Improve `--bless` output for `tests/debuginfo`)
 - #164202 ([rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running)
 - #162140 (fn_addr_eq: we actually can guarantee basically nothing)
 - #163946 (Fix transmutability type mismatch bug)
 - #163978 (Copy over some methods from At to InferCtxt)
 - #164045 (-Zassumptions-on-binders: replace region vars with bound vars when handling alias outlives')
@rust-bors
rust-bors Bot merged commit 0bfc997 into rust-lang:main Oct 12, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 12, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 12, 2026
Rollup merge of #164202 - GuillaumeGomez:fix-doctest-temp-removal, r=RalfJung,Urgau

[rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running

Fixes #164145.

Fixes one missed case in #161868: the `IndividualTestOptions` should have been created directly into the `DynTestFn` closure so its temporary directory is removed right after it's done running.

r? @RalfJung
@GuillaumeGomez
GuillaumeGomez deleted the fix-doctest-temp-removal branch October 12, 2026 21:10
@apiraino

Copy link
Copy Markdown
Contributor

removing t-compiler since this seems to be entirely T-rustdoc
@rustbot label -T-compiler

(probably good to backport, imo)

@rustbot rustbot removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 15, 2026
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 beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.100 beta crater regression: "No space left on device" and massive slowdown during doctests

6 participants