about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2025-02-18 15:34:34 +0000
committeronur-ozkan <work@onurozkan.dev>2025-02-18 15:35:51 +0000
commit5e5b1b054aae3407f4226ccae2b321e114990776 (patch)
treef67dbbd14cd82d9f98614cd21d3aeaa88cc4ffcd /src
parent6cf650fce7c9a599b18df72b1bac202a19eb81cd (diff)
downloadrust-5e5b1b054aae3407f4226ccae2b321e114990776.tar.gz
rust-5e5b1b054aae3407f4226ccae2b321e114990776.zip
document tool implementations
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index f734776a3d8..7adb7b4681f 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1,3 +1,14 @@
+//! This module handles building and managing various tools in bootstrap
+//! build system.
+//!
+//! **What It Does**
+//! - Defines how tools are built, configured and installed.
+//! - Manages tool dependencies and build steps.
+//! - Copies built tool binaries to the correct locations.
+//!
+//! Each Rust tool **MUST** utilize `ToolBuild` inside their `Step` logic,
+//! return `ToolBuildResult` and should never prepare `cargo` invocations manually.
+
 use std::path::PathBuf;
 use std::{env, fs};
 
@@ -64,10 +75,16 @@ impl Builder<'_> {
     }
 }
 
+/// Result of the tool build process. Each `Step` in this module is responsible
+/// for using this type as `type Output = ToolBuildResult;`
 #[derive(Clone)]
 pub struct ToolBuildResult {
+    /// Executable path of the corresponding tool that was built.
     pub tool_path: PathBuf,
+    /// Compiler used to build the tool. For non-`ToolRustc` tools this is equal to `target_compiler`.
+    /// For `ToolRustc` this is one stage before of the `target_compiler`.
     pub build_compiler: Compiler,
+    /// Target compiler passed to `Step`.
     pub target_compiler: Compiler,
 }
 
@@ -274,6 +291,7 @@ pub fn prepare_tool_cargo(
     cargo
 }
 
+/// Handle stage-off logic for `ToolRustc` tools when necessary.
 pub(crate) fn get_tool_rustc_compiler(
     builder: &Builder<'_>,
     target_compiler: Compiler,