Skip to main content

Module config

Module config 

Source
Expand description

This module defines the central Config struct, which aggregates all components of the bootstrap configuration into a single unit.

It serves as the primary public interface for accessing the bootstrap configuration. The module coordinates the overall configuration parsing process using logic from parsing.rs and provides top-level methods such as Config::parse() for initialization, as well as utility methods for querying and manipulating the complete configuration state.

Additionally, this module contains the core logic for parsing, validating, and inferring the final Config from various raw inputs.

It manages the process of reading command-line arguments, environment variables, and the bootstrap.toml fileβ€”merging them, applying defaults, and performing cross-component validation. The main parse_inner function and its supporting helpers reside here, transforming raw Toml data into the structured Config type.

Re-exportsΒ§

use std::collections::BTreeSet; πŸ”’
use std::collections::HashMap; πŸ”’
use std::collections::HashSet; πŸ”’
use std::io::IsTerminal; πŸ”’
use std::path::Path; πŸ”’
use std::path::PathBuf; πŸ”’
use std::path::absolute; πŸ”’
use std::str::FromStr; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::Mutex; πŸ”’
use std::sync::OnceLock; πŸ”’
use std::cmp; πŸ”’
use std::env; πŸ”’
use std::env; πŸ”’
use std::fs; πŸ”’
use build_helper::ci::CiEnv; πŸ”’
use build_helper::git::GitConfig; πŸ”’
use build_helper::git::PathFreshness; πŸ”’
use build_helper::git::check_path_modifications; πŸ”’
use serde::Deserialize; πŸ”’
use crate::core::backend::CodegenBackendKind; πŸ”’
use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS; πŸ”’
use crate::core::build_steps::llvm::LlvmKind; πŸ”’
use crate::core::build_steps::llvm::LlvmOutput; πŸ”’
use crate::core::build_steps::test::failed_tests::collect_previously_failed_tests; πŸ”’
use crate::core::config::flags::Color; πŸ”’
use crate::core::config::flags::Flags; πŸ”’
use crate::core::config::flags::Subcommand; πŸ”’
use crate::core::config::flags::Warnings; πŸ”’
use crate::core::config::target_selection::TargetSelectionList; πŸ”’
use crate::core::config::toml::TomlConfig; πŸ”’
use crate::core::config::toml::build::Build; πŸ”’
use crate::core::config::toml::build::Tool; πŸ”’
use crate::core::config::toml::change_id::ChangeId; πŸ”’
use crate::core::config::toml::dist::Dist; πŸ”’
use crate::core::config::toml::gcc::Gcc; πŸ”’
use crate::core::config::toml::install::Install; πŸ”’
use crate::core::config::toml::llvm::Llvm; πŸ”’
use crate::core::config::toml::pgo::Pgo; πŸ”’
use crate::core::config::toml::pgo::PgoConfig; πŸ”’
use crate::core::config::toml::rust::BootstrapOverrideLld; πŸ”’
use crate::core::config::toml::rust::Rust; πŸ”’
use crate::core::config::toml::rust::RustOptimize; πŸ”’
use crate::core::config::toml::rust::check_incompatible_options_for_ci_rustc; πŸ”’
use crate::core::config::toml::rust::parse_codegen_backends; πŸ”’
use crate::core::config::toml::target::DefaultLinuxLinkerOverride; πŸ”’
use crate::core::config::toml::target::Target; πŸ”’
use crate::core::config::toml::target::TomlTarget; πŸ”’
use crate::core::config::toml::target::default_linux_linker_overrides; πŸ”’
use crate::core::config::Allocator; πŸ”’
use crate::core::config::CompilerBuiltins; πŸ”’
use crate::core::config::CompressDebuginfo; πŸ”’
use crate::core::config::DebuggerPath; πŸ”’
use crate::core::config::DebuginfoLevel; πŸ”’
use crate::core::config::DryRun; πŸ”’
use crate::core::config::GccCiMode; πŸ”’
use crate::core::config::LlvmCiMode; πŸ”’
use crate::core::config::LlvmLibunwind; πŸ”’
use crate::core::config::Merge; πŸ”’
use crate::core::config::ReplaceOpt; πŸ”’
use crate::core::config::RustcLto; πŸ”’
use crate::core::config::SplitDebuginfo; πŸ”’
use crate::core::config::StringOrBool; πŸ”’
use crate::core::config::TargetSelection; πŸ”’
use crate::core::config::threads_from_config; πŸ”’
use crate::core::download::DownloadContext; πŸ”’
use crate::core::download::is_download_ci_available; πŸ”’
use crate::utils::channel; πŸ”’
use crate::utils::channel::GitInfo; πŸ”’
use crate::utils::exec::ExecutionContext; πŸ”’
use crate::utils::exec::command; πŸ”’
use crate::utils::helpers; πŸ”’
use crate::utils::helpers::exe; πŸ”’
use crate::utils::helpers::fail; πŸ”’
use crate::utils::helpers::get_host_target; πŸ”’
use crate::utils::helpers::t; πŸ”’

StructsΒ§

Config πŸ”’
Global configuration for the entire build and/or bootstrap.
LlvmPgoConfig

EnumsΒ§

LlvmPgoGenerationMode
WouldBeValidFor πŸ”’

ConstantsΒ§

RUSTC_IF_UNCHANGED_ALLOWED_PATHS
Each path in this list is considered β€œallowed” in the download-rustc="if-unchanged" logic. This means they can be modified and changes to these paths should never trigger a compiler build when β€œif-unchanged” is set.

FunctionsΒ§

bad_config πŸ”’
check_external_binary_version πŸ”’
Check that the version of an externally provided rustc/cargo is either the same or 1 version older than the in-tree version.
check_path_modifications_
compute_src_directory_via_git πŸ”’
download_ci_rustc_commit
find_correct_section_for_field πŸ”’
git_config
git_info
has_changes_from_upstream
join_oxford_comma πŸ”’
load_toml_config πŸ”’
Loads bootstrap TOML config and returns the config together with a path from where it was loaded. src is the source root directory, and config_path is an optionally provided path to the config.
parse_download_ci_llvm
postprocess_toml πŸ”’
print_rustc_modifications πŸ”’
read_file_by_commit πŸ”’
Returns the content of the given file at a specific commit.
reconcile_jemalloc πŸ”’
Reconciles the deprecated jemalloc boolean option with the new allocator option.
submodules_
update_submodule πŸ”’