rust/src/librustdoc
Guillaume Gomez 83e3d0e17b
Rollup merge of #140706 - GuillaumeGomez:fix-missing-temp-dir-cleanup, r=notriddle
[rustdoc] Ensure that temporary doctest folder is correctly removed even if doctests failed

Fixes #139899.

The bug was due to the fact that if any doctest fails for any reason, we call `exit` (or it's called inside `libtest` if not edition 2024), meaning that `TempDir`'s destructor isn't called, and therefore the temporary folder isn't cleaned up.

Took me a while to figure out how to reproduce but finally I was able to reproduce the bug with:

`````rust
#![doc(test(attr(deny(warnings))))]

//! ```
//! let a = 12;
//! ```
`````

And then I ensured that panicking doctests were cleaned up as well:

`````rust
//! ```
//! panic!();
//! ```
`````

And finally I checked if it was fixed for merged doctests too (`--edition 2024`).

To make this work, I needed to add a new public function in `libtest` too which would call a function once all tests have been run.

So only issue is: I have absolutely no idea how we can add a regression test for this fix. If anyone has an idea...

r? `@notriddle`
2025-05-07 18:19:07 +02:00
..
clean Rollup merge of #140316 - nnethercote:BoxMarker, r=dtolnay 2025-04-28 13:30:45 +02:00
doctest Ensure that temporary doctest folder is correctly removed even if doctests failed 2025-05-06 19:32:20 +02:00
formats librustdoc: remove IndexItem::new, use previous fields constructor 2025-04-09 20:51:52 +08:00
html Rollup merge of #140135 - GuillaumeGomez:sidebars-image, r=rustdoc 2025-05-06 14:50:45 +02:00
json Make rustdoc JSON Span column 1-based, just like line numbers 2025-04-18 20:32:40 +02:00
passes rustdoc: remove unportable markdown lint and old parser 2025-05-06 10:33:04 -07:00
theme rustdoc: merge theme css into rustdoc.css 2023-09-15 07:40:17 -07:00
askama.toml Update to new rinja version (askama) 2025-04-03 15:38:08 +02:00
build.rs Auto merge of #136253 - notriddle:notriddle/aot-minify, r=GuillaumeGomez 2025-02-05 18:28:16 +00:00
Cargo.toml rustdoc: remove unportable markdown lint and old parser 2025-05-06 10:33:04 -07:00
config.rs Remove and stabilize --enable-per-target-ignores 2025-03-27 19:06:48 -07:00
core.rs Rollup merge of #139615 - nnethercote:rm-name_or_empty, r=jdonszelmann 2025-04-18 05:16:29 +02:00
display.rs x clippy src/librustdoc --fix 2025-03-06 16:06:41 +00:00
docfs.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
doctest.rs Ensure that temporary doctest folder is correctly removed even if doctests failed 2025-05-06 19:32:20 +02:00
error.rs Fix clippy lints 2024-08-29 12:14:41 +02:00
externalfiles.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
fold.rs Rename TyMethodItem -> RequiredMethodItem 2024-12-19 10:48:51 -08:00
lib.rs Allow linking rustc and rustdoc against the same single tracing crate 2025-05-03 10:18:50 -07:00
lint.rs rustdoc: remove unportable markdown lint and old parser 2025-05-06 10:33:04 -07:00
markdown.rs rustdoc: Document markdown module. 2024-10-19 13:37:40 +00:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs Move methods from Map to TyCtxt, part 5. 2025-04-02 10:00:46 +11:00
theme.rs Fix new clippy lints 2024-11-28 03:05:43 +01:00
visit.rs Rename TyMethodItem -> RequiredMethodItem 2024-12-19 10:48:51 -08:00
visit_ast.rs Move hir::Item::ident into hir::ItemKind. 2025-03-18 06:29:50 +11:00
visit_lib.rs librustdoc: flatten nested ifs 2025-03-06 08:16:28 +00:00

For more information about how librustdoc works, see the rustc dev guide.