Skip to content

Commit 2f287d6

Browse files
committed
Make it possible to write doctests for bootstrap
This probably isn't super useful in practice, but it was easy to fix and avoids confusing errors about mismatched versions between beta and the default toolchain.
1 parent 18f314e commit 2f287d6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/bootstrap/test.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,6 +2362,7 @@ impl Step for Bootstrap {
23622362
.env("RUSTFLAGS", "-Cdebuginfo=2")
23632363
.env("CARGO_TARGET_DIR", builder.out.join("bootstrap"))
23642364
.env("RUSTC_BOOTSTRAP", "1")
2365+
.env("RUSTDOC", builder.rustdoc(builder.compiler(0, builder.build.build)))
23652366
.env("RUSTC", &builder.initial_rustc);
23662367
if let Some(flags) = option_env!("RUSTFLAGS") {
23672368
// Use the same rustc flags for testing as for "normal" compilation,
@@ -2372,6 +2373,16 @@ impl Step for Bootstrap {
23722373
if !builder.fail_fast {
23732374
cmd.arg("--no-fail-fast");
23742375
}
2376+
match builder.doc_tests {
2377+
DocTests::Only => {
2378+
cmd.arg("--doc");
2379+
}
2380+
DocTests::No => {
2381+
cmd.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
2382+
}
2383+
DocTests::Yes => {}
2384+
}
2385+
23752386
cmd.arg("--").args(&builder.config.cmd.test_args());
23762387
// rustbuild tests are racy on directory creation so just run them one at a time.
23772388
// Since there's not many this shouldn't be a problem.

0 commit comments

Comments
 (0)