about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-09-05 16:22:52 +0200
committerJakub Beránek <berykubik@gmail.com>2025-09-05 16:22:52 +0200
commita6aa509687a125e9a3cac3da229369edb67e3205 (patch)
treea29112a09120e3ee8d9273d8f636172dba2f626b
parent9f9473f201e73a74c87ff5532828ad82b42b508e (diff)
downloadrust-a6aa509687a125e9a3cac3da229369edb67e3205.tar.gz
rust-a6aa509687a125e9a3cac3da229369edb67e3205.zip
Respect top stage when documenting Cargo
-rw-r--r--src/bootstrap/src/core/build_steps/doc.rs2
-rw-r--r--src/bootstrap/src/core/builder/tests.rs15
2 files changed, 15 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 6aa2b75d5ba..a1a16980be6 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -1005,7 +1005,7 @@ macro_rules! tool_doc {
                     }
                     Mode::ToolTarget => {
                         // target tools should be documented with the in-tree compiler
-                        prepare_doc_compiler(run.builder, run.builder.host_target, 2)
+                        prepare_doc_compiler(run.builder, run.builder.host_target, run.builder.top_stage)
                     }
                     _ => {
                         panic!("Unexpected tool mode for documenting: {:?}", $mode);
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index da9e1ecad7b..e7b92dbc18f 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -2463,12 +2463,25 @@ mod snapshot {
     }
 
     #[test]
-    fn doc_cargo() {
+    fn doc_cargo_stage_1() {
         let ctx = TestCtx::new();
         insta::assert_snapshot!(
             ctx.config("doc")
                 .path("cargo")
                 .render_steps(), @r"
+        [build] rustdoc 0 <host>
+        [doc] rustc 0 <host> -> Cargo 1 <host>
+        ");
+    }
+
+    #[test]
+    fn doc_cargo_stage_2() {
+        let ctx = TestCtx::new();
+        insta::assert_snapshot!(
+            ctx.config("doc")
+                .path("cargo")
+                .stage(2)
+                .render_steps(), @r"
         [build] llvm <host>
         [build] rustc 0 <host> -> rustc 1 <host>
         [build] rustc 1 <host> -> std 1 <host>