Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6a6dbc8

Browse files
authoredApr 28, 2024··
Unrolled build for rust-lang#124429
Rollup merge of rust-lang#124429 - Enselic:document-builder, r=Mark-Simulacrum bootstrap: Document `struct Builder` and its fields I'm exploring the code of bootstrap and had a bit of a hard time understanding exactly what `Builder` is for at first. I decided to help document it and its field to help future explorers.
2 parents aed2187 + 4e83776 commit 6a6dbc8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
 

‎src/bootstrap/src/core/builder.rs

+21
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,34 @@ use once_cell::sync::Lazy;
3434
#[cfg(test)]
3535
mod tests;
3636

37+
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
38+
/// into account build configuration from e.g. config.toml.
3739
pub struct Builder<'a> {
40+
/// Build configuration from e.g. config.toml.
3841
pub build: &'a Build,
42+
43+
/// The stage to use. Either implicitly determined based on subcommand, or
44+
/// explicitly specified with `--stage N`. Normally this is the stage we
45+
/// use, but sometimes we want to run steps with a lower stage than this.
3946
pub top_stage: u32,
47+
48+
/// What to build or what action to perform.
4049
pub kind: Kind,
50+
51+
/// A cache of outputs of [`Step`]s so we can avoid running steps we already
52+
/// ran.
4153
cache: Cache,
54+
55+
/// A stack of [`Step`]s to run before we can run this builder. The output
56+
/// of steps is cached in [`Self::cache`].
4257
stack: RefCell<Vec<Box<dyn Any>>>,
58+
59+
/// The total amount of time we spent running [`Step`]s in [`Self::stack`].
4360
time_spent_on_dependencies: Cell<Duration>,
61+
62+
/// The paths passed on the command line. Used by steps to figure out what
63+
/// to do. For example: with `./x check foo bar` we get `paths=["foo",
64+
/// "bar"]`.
4465
pub paths: Vec<PathBuf>,
4566
}
4667

‎src/bootstrap/src/core/config/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ pub struct Config {
345345
#[cfg(test)]
346346
pub initial_rustfmt: RefCell<RustfmtState>,
347347

348+
/// The paths to work with. For example: with `./x check foo bar` we get
349+
/// `paths=["foo", "bar"]`.
348350
pub paths: Vec<PathBuf>,
349351
}
350352

0 commit comments

Comments
 (0)