Skip to content

Commit 877aa18

Browse files
committed
add doc to all the newly created modules
1 parent 474f3b0 commit 877aa18

File tree

12 files changed

+79
-6
lines changed

12 files changed

+79
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! This module orchestrates the overall configuration parsing process by leveraging
66
//! logic from `parsing.rs` and provides top-level methods for initializing (`Config::parse()`)
77
//! and querying the comprehensive configuration state. It also contains various utility
8-
//! methods that operate on the overall configuration.
8+
//! methods that operate on the overall config struct.
99
1010
use std::cell::Cell;
1111
use std::collections::{BTreeSet, HashMap, HashSet};

src/bootstrap/src/core/config/toml/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! This module defines the `Build` struct, which represents the `[build]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
//!
4+
//! The `[build]` table contains global options that influence the overall build process,
5+
//! such as default host and target triples, paths to tools, build directories, and
6+
//! various feature flags. These options apply across different stages and components
7+
//! unless specifically overridden by other configuration sections or command-line flags.
8+
19
use serde::{Deserialize, Deserializer};
210

311
use crate::core::config::toml::common::StringOrBool;

src/bootstrap/src/core/config/toml/common.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! This module defines common types, enums, and helper functions used across
2+
//! various TOML configuration sections within `bootstrap.toml`.
3+
//!
4+
//! It provides shared definitions for:
5+
//! - Data types that are serialized from TOML.
6+
//! - Utility enums for specific configuration options.
7+
//! - Helper functions for managing configuration values.
8+
19
use std::fmt::Display;
210

311
use serde::{Deserialize, Deserializer};

src/bootstrap/src/core/config/toml/dist.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! This module defines the `Dist` struct, which represents the `[dist]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
//!
4+
//! The `[dist]` table contains options related to the distribution process,
5+
//! including signing, uploading artifacts, source tarballs, compression settings,
6+
//! and inclusion of specific tools.
7+
18
use serde::{Deserialize, Deserializer};
29

310
use crate::core::config::set;
@@ -17,6 +24,8 @@ define_config! {
1724
}
1825

1926
impl Config {
27+
/// Applies distribution-related configuration from the `Dist` struct
28+
/// to the global `Config` structure.
2029
pub fn apply_dist_config(&mut self, toml_dist: Option<Dist>) {
2130
if let Some(dist) = toml_dist {
2231
let Dist {

src/bootstrap/src/core/config/toml/gcc.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! This module defines the `Gcc` struct, which represents the `[gcc]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
//!
4+
//! The `[gcc]` table contains options specifically related to building or
5+
//! acquiring the GCC compiler for use within the Rust build process.
6+
17
use serde::{Deserialize, Deserializer};
28

39
use crate::core::config::GccCiMode;
@@ -12,6 +18,8 @@ define_config! {
1218
}
1319

1420
impl Config {
21+
/// Applies GCC-related configuration from the `TomlGcc` struct to the
22+
/// global `Config` structure.
1523
pub fn apply_gcc_config(&mut self, toml_gcc: Option<Gcc>) {
1624
if let Some(gcc) = toml_gcc {
1725
self.gcc_ci_mode = match gcc.download_ci_gcc {

src/bootstrap/src/core/config/toml/install.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! This module defines the `Install` struct, which represents the `[install]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
//!
4+
//! The `[install]` table contains options that specify the installation paths
5+
//! for various components of the Rust toolchain. These paths determine where
6+
//! executables, libraries, documentation, and other files will be placed
7+
//! during the `install` stage of the build.
8+
19
use serde::{Deserialize, Deserializer};
210

311
use crate::core::config::set;
@@ -18,6 +26,8 @@ define_config! {
1826
}
1927

2028
impl Config {
29+
/// Applies installation-related configuration from the `Install` struct
30+
/// to the global `Config` structure.
2131
pub fn apply_install_config(&mut self, toml_install: Option<Install>) {
2232
if let Some(install) = toml_install {
2333
let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install;

src/bootstrap/src/core/config/toml/llvm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! This module defines the `Llvm` struct, which represents the `[llvm]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
14
use serde::{Deserialize, Deserializer};
25

36
use crate::core::config::set;

src/bootstrap/src/core/config/toml/macros.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! This module define two macros:
2+
//!
3+
//! The `define_config!` macro avoids the use of `#[derive(Deserialize)]` to reduce compile time
4+
//! and binary size, particularly for the bootstrap binary.
5+
//!
6+
//! The `check_ci_llvm!` macro provides a compile-time assertion to ensure certain settings are
7+
//! not used when `download-ci-llvm` is enabled.
8+
19
// We are using a decl macro instead of a derive proc macro here to reduce the compile time of bootstrap.
210
#[macro_export]
311
macro_rules! define_config {

src/bootstrap/src/core/config/toml/merge.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Provides traits and implementations for merging configuration structures.
12
use std::collections::HashSet;
23
use std::path::PathBuf;
34

src/bootstrap/src/core/config/toml/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! This module defines the structures that directly mirror the `bootstrap.toml`
2-
//! file's format. These types are used for `serde` deserialization, serving as an
3-
//! intermediate representation that gets processed and merged into the final `Config`
4-
//! types from the `types` module.
2+
//! file's format. These types are used for `serde` deserialization.
53
//!
6-
//! It also houses the `Merge` trait and `define_config!` macro, which are essential
7-
//! for handling these raw TOML structures.
4+
//! Crucially, this module also houses the core logic for loading, parsing, and merging
5+
//! these raw TOML configurations from various sources (the main `bootstrap.toml`,
6+
//! included files, profile defaults, and command-line overrides). This processed
7+
//! TOML data then serves as an intermediate representation, which is further
8+
//! transformed and applied to the final [`Config`] struct.
89
910
use serde::Deserialize;
1011
use serde_derive::Deserialize;

src/bootstrap/src/core/config/toml/rust.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! This module defines the `Rust` struct, which represents the `[rust]` table
2+
//! in the `bootstrap.toml` configuration file.
3+
14
use std::str::FromStr;
25

36
use serde::{Deserialize, Deserializer};

src/bootstrap/src/core/config/toml/target.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//! This module defines the structures and logic for handling target-specific configuration
2+
//! within the `bootstrap.toml` file. This allows you to customize build settings, tools,
3+
//! and flags for individual compilation targets.
4+
//!
5+
//! It includes:
6+
//!
7+
//! * [`TomlTarget`]: This struct directly mirrors the `[target.<triple>]` sections in your
8+
//! `bootstrap.toml`. It's used for deserializing raw TOML data for a specific target.
9+
//! * [`Target`]: This struct represents the processed and validated configuration for a
10+
//! build target, which is is stored in the main [`Config`] structure.
11+
//! * [`Config::apply_target_config`]: This method processes the `TomlTarget` data and
12+
//! applies it to the global [`Config`], ensuring proper path resolution, validation,
13+
//! and integration with other build settings.
14+
115
use std::collections::HashMap;
216

317
use serde::{Deserialize, Deserializer};

0 commit comments

Comments
 (0)