about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-17 17:06:10 +0100
committerGitHub <noreply@github.com>2025-02-17 17:06:10 +0100
commit97962d7643300b91c102496ba3ab6d9279d2c536 (patch)
tree235d61ec7a4e5b34b46fa1769be6372f5f1163fa
parent48543dd66d1a9dfe56f9d218ab69e5ed9c955704 (diff)
parentea10f8efa1d9515a2ced80a05245c5bd19e55040 (diff)
downloadrust-97962d7643300b91c102496ba3ab6d9279d2c536.tar.gz
rust-97962d7643300b91c102496ba3ab6d9279d2c536.zip
Rollup merge of #137073 - niklaskorz:bootstrap-doc-fix-empty-no-std, r=clubby789
boostrap: skip no_std targets in Std doc step

This fixes a bug that currently prevents us from adding no_std library targets to rustc in nixpkgs (https://github.com/NixOS/nixpkgs/pull/382166).

When running `./x.py doc`, the `Std` doc step generally fails for no_std targets, logs: https://gist.github.com/niklaskorz/fb83f9503ce19b75e8b1af02cdebd592

Skipping no_std targets in this step will allow using no_std targets such as `bpfel-unknown-none` together with other targets in the same config without blocking the doc generator for them, e.g.

```
./configure --release-channel=stable --tools=rustc,rustdoc,rust-analyzer-proc-macro-srv --build=aarch64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin,bpfel-unknown-none

./x.py doc
```

Logs with this fix applied: https://gist.github.com/niklaskorz/cdd50aaea33ede579f737434286d800b
-rw-r--r--src/bootstrap/src/core/build_steps/doc.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 23bb47dcc58..aee56fe78e2 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -577,6 +577,10 @@ impl Step for Std {
 
     fn make_run(run: RunConfig<'_>) {
         let crates = compile::std_crates_for_run_make(&run);
+        let target_is_no_std = run.builder.no_std(run.target).unwrap_or(false);
+        if crates.is_empty() && target_is_no_std {
+            return;
+        }
         run.builder.ensure(Std {
             stage: run.builder.top_stage,
             target: run.target,