bootstrap

Struct Config

Source
pub struct Config {
Show 167 fields pub change_id: Option<usize>, pub bypass_bootstrap_lock: bool, pub ccache: Option<String>, pub ninja_in_file: bool, pub verbose: usize, pub submodules: Option<bool>, pub compiler_docs: bool, pub library_docs_private_items: bool, pub docs_minification: bool, pub docs: bool, pub locked_deps: bool, pub vendor: bool, pub target_config: HashMap<TargetSelection, Target>, pub full_bootstrap: bool, pub bootstrap_cache_path: Option<PathBuf>, pub extended: bool, pub tools: Option<HashSet<String>>, pub sanitizers: bool, pub profiler: bool, pub omit_git_hash: bool, pub skip: Vec<PathBuf>, pub include_default_paths: bool, pub rustc_error_format: Option<String>, pub json_output: bool, pub test_compare_mode: bool, pub color: Color, pub patch_binaries_for_nix: Option<bool>, pub stage0_metadata: Stage0, pub android_ndk: Option<PathBuf>, pub optimized_compiler_builtins: bool, pub stdout_is_tty: bool, pub stderr_is_tty: bool, pub on_fail: Option<String>, pub stage: u32, pub keep_stage: Vec<u32>, pub keep_stage_std: Vec<u32>, pub src: PathBuf, pub config: Option<PathBuf>, pub jobs: Option<u32>, pub cmd: Subcommand, pub incremental: bool, pub dry_run: DryRun, pub dump_bootstrap_shims: bool, pub free_args: Vec<String>, download_rustc_commit: Option<String>, pub deny_warnings: bool, pub backtrace_on_ice: bool, pub llvm_assertions: bool, pub llvm_tests: bool, pub llvm_enzyme: bool, pub llvm_offload: bool, pub llvm_plugins: bool, pub llvm_optimize: bool, pub llvm_thin_lto: bool, pub llvm_release_debuginfo: bool, pub llvm_static_stdcpp: bool, pub llvm_libzstd: bool, llvm_link_shared: Cell<Option<bool>>, pub llvm_clang_cl: Option<String>, pub llvm_targets: Option<String>, pub llvm_experimental_targets: Option<String>, pub llvm_link_jobs: Option<u32>, pub llvm_version_suffix: Option<String>, pub llvm_use_linker: Option<String>, pub llvm_allow_old_toolchain: bool, pub llvm_polly: bool, pub llvm_clang: bool, pub llvm_enable_warnings: bool, pub llvm_from_ci: bool, pub llvm_build_config: HashMap<String, String>, pub lld_mode: LldMode, pub lld_enabled: bool, pub llvm_tools_enabled: bool, pub llvm_bitcode_linker_enabled: bool, pub llvm_cflags: Option<String>, pub llvm_cxxflags: Option<String>, pub llvm_ldflags: Option<String>, pub llvm_use_libcxx: bool, pub rust_optimize: RustOptimize, pub rust_codegen_units: Option<u32>, pub rust_codegen_units_std: Option<u32>, pub rustc_debug_assertions: bool, pub std_debug_assertions: bool, pub rust_overflow_checks: bool, pub rust_overflow_checks_std: bool, pub rust_debug_logging: bool, pub rust_debuginfo_level_rustc: DebuginfoLevel, pub rust_debuginfo_level_std: DebuginfoLevel, pub rust_debuginfo_level_tools: DebuginfoLevel, pub rust_debuginfo_level_tests: DebuginfoLevel, pub rust_rpath: bool, pub rust_strip: bool, pub rust_frame_pointers: bool, pub rust_stack_protector: Option<String>, pub rustc_default_linker: Option<String>, pub rust_optimize_tests: bool, pub rust_dist_src: bool, pub rust_codegen_backends: Vec<String>, pub rust_verify_llvm_ir: bool, pub rust_thin_lto_import_instr_limit: Option<u32>, pub rust_randomize_layout: bool, pub rust_remap_debuginfo: bool, pub rust_new_symbol_mangling: Option<bool>, pub rust_profile_use: Option<String>, pub rust_profile_generate: Option<String>, pub rust_lto: RustcLto, pub rust_validate_mir_opts: Option<u32>, pub rust_std_features: BTreeSet<String>, pub llvm_profile_use: Option<String>, pub llvm_profile_generate: bool, pub llvm_libunwind_default: Option<LlvmLibunwind>, pub enable_bolt_settings: bool, pub reproducible_artifacts: Vec<String>, pub build: TargetSelection, pub hosts: Vec<TargetSelection>, pub targets: Vec<TargetSelection>, pub local_rebuild: bool, pub jemalloc: bool, pub control_flow_guard: bool, pub ehcont_guard: bool, pub dist_sign_folder: Option<PathBuf>, pub dist_upload_addr: Option<String>, pub dist_compression_formats: Option<Vec<String>>, pub dist_compression_profile: String, pub dist_include_mingw_linker: bool, pub dist_vendor: bool, pub backtrace: bool, pub low_priority: bool, pub channel: String, pub description: Option<String>, pub verbose_tests: bool, pub save_toolstates: Option<PathBuf>, pub print_step_timings: bool, pub print_step_rusage: bool, pub musl_root: Option<PathBuf>, pub prefix: Option<PathBuf>, pub sysconfdir: Option<PathBuf>, pub datadir: Option<PathBuf>, pub docdir: Option<PathBuf>, pub bindir: PathBuf, pub libdir: Option<PathBuf>, pub mandir: Option<PathBuf>, pub codegen_tests: bool, pub nodejs: Option<PathBuf>, pub npm: Option<PathBuf>, pub gdb: Option<PathBuf>, pub lldb: Option<PathBuf>, pub python: Option<PathBuf>, pub reuse: Option<PathBuf>, pub cargo_native_static: bool, pub configure_args: Vec<String>, pub out: PathBuf, pub rust_info: GitInfo, pub cargo_info: GitInfo, pub rust_analyzer_info: GitInfo, pub clippy_info: GitInfo, pub miri_info: GitInfo, pub rustfmt_info: GitInfo, pub enzyme_info: GitInfo, pub in_tree_llvm_info: GitInfo, pub in_tree_gcc_info: GitInfo, pub initial_cargo: PathBuf, pub initial_rustc: PathBuf, pub initial_cargo_clippy: Option<PathBuf>, initial_rustfmt: RefCell<RustfmtState>, pub paths: Vec<PathBuf>, pub compiletest_diff_tool: Option<String>,
}
Expand description

Global configuration for the entire build and/or bootstrap.

This structure is parsed from config.toml, and some of the fields are inferred from git or build-time parameters.

Note that this structure is not decoded directly into, but rather it is filled out from the decoded forms of the structs below. For documentation each field, see the corresponding fields in config.example.toml.

Fields§

§change_id: Option<usize>§bypass_bootstrap_lock: bool§ccache: Option<String>§ninja_in_file: bool

Call Build::ninja() instead of this.

§verbose: usize§submodules: Option<bool>§compiler_docs: bool§library_docs_private_items: bool§docs_minification: bool§docs: bool§locked_deps: bool§vendor: bool§target_config: HashMap<TargetSelection, Target>§full_bootstrap: bool§bootstrap_cache_path: Option<PathBuf>§extended: bool§tools: Option<HashSet<String>>§sanitizers: bool§profiler: bool§omit_git_hash: bool§skip: Vec<PathBuf>§include_default_paths: bool§rustc_error_format: Option<String>§json_output: bool§test_compare_mode: bool§color: Color§patch_binaries_for_nix: Option<bool>§stage0_metadata: Stage0§android_ndk: Option<PathBuf>§optimized_compiler_builtins: bool

Whether to use the c feature of the compiler_builtins crate.

§stdout_is_tty: bool§stderr_is_tty: bool§on_fail: Option<String>§stage: u32§keep_stage: Vec<u32>§keep_stage_std: Vec<u32>§src: PathBuf§config: Option<PathBuf>

defaults to config.toml

§jobs: Option<u32>§cmd: Subcommand§incremental: bool§dry_run: DryRun§dump_bootstrap_shims: bool§free_args: Vec<String>

Arguments appearing after -- to be forwarded to tools, e.g. --fix-broken or test arguments.

§download_rustc_commit: Option<String>

None if we shouldn’t download CI compiler artifacts, or the commit to download if we should.

§deny_warnings: bool§backtrace_on_ice: bool§llvm_assertions: bool§llvm_tests: bool§llvm_enzyme: bool§llvm_offload: bool§llvm_plugins: bool§llvm_optimize: bool§llvm_thin_lto: bool§llvm_release_debuginfo: bool§llvm_static_stdcpp: bool§llvm_libzstd: bool§llvm_link_shared: Cell<Option<bool>>

None if llvm_from_ci is true and we haven’t yet downloaded llvm.

§llvm_clang_cl: Option<String>§llvm_targets: Option<String>§llvm_experimental_targets: Option<String>§llvm_link_jobs: Option<u32>§llvm_version_suffix: Option<String>§llvm_use_linker: Option<String>§llvm_allow_old_toolchain: bool§llvm_polly: bool§llvm_clang: bool§llvm_enable_warnings: bool§llvm_from_ci: bool§llvm_build_config: HashMap<String, String>§lld_mode: LldMode§lld_enabled: bool§llvm_tools_enabled: bool§llvm_bitcode_linker_enabled: bool§llvm_cflags: Option<String>§llvm_cxxflags: Option<String>§llvm_ldflags: Option<String>§llvm_use_libcxx: bool§rust_optimize: RustOptimize§rust_codegen_units: Option<u32>§rust_codegen_units_std: Option<u32>§rustc_debug_assertions: bool§std_debug_assertions: bool§rust_overflow_checks: bool§rust_overflow_checks_std: bool§rust_debug_logging: bool§rust_debuginfo_level_rustc: DebuginfoLevel§rust_debuginfo_level_std: DebuginfoLevel§rust_debuginfo_level_tools: DebuginfoLevel§rust_debuginfo_level_tests: DebuginfoLevel§rust_rpath: bool§rust_strip: bool§rust_frame_pointers: bool§rust_stack_protector: Option<String>§rustc_default_linker: Option<String>§rust_optimize_tests: bool§rust_dist_src: bool§rust_codegen_backends: Vec<String>§rust_verify_llvm_ir: bool§rust_thin_lto_import_instr_limit: Option<u32>§rust_randomize_layout: bool§rust_remap_debuginfo: bool§rust_new_symbol_mangling: Option<bool>§rust_profile_use: Option<String>§rust_profile_generate: Option<String>§rust_lto: RustcLto§rust_validate_mir_opts: Option<u32>§rust_std_features: BTreeSet<String>§llvm_profile_use: Option<String>§llvm_profile_generate: bool§llvm_libunwind_default: Option<LlvmLibunwind>§enable_bolt_settings: bool§reproducible_artifacts: Vec<String>§build: TargetSelection§hosts: Vec<TargetSelection>§targets: Vec<TargetSelection>§local_rebuild: bool§jemalloc: bool§control_flow_guard: bool§ehcont_guard: bool§dist_sign_folder: Option<PathBuf>§dist_upload_addr: Option<String>§dist_compression_formats: Option<Vec<String>>§dist_compression_profile: String§dist_include_mingw_linker: bool§dist_vendor: bool§backtrace: bool§low_priority: bool§channel: String§description: Option<String>§verbose_tests: bool§save_toolstates: Option<PathBuf>§print_step_timings: bool§print_step_rusage: bool§musl_root: Option<PathBuf>§prefix: Option<PathBuf>§sysconfdir: Option<PathBuf>§datadir: Option<PathBuf>§docdir: Option<PathBuf>§bindir: PathBuf§libdir: Option<PathBuf>§mandir: Option<PathBuf>§codegen_tests: bool§nodejs: Option<PathBuf>§npm: Option<PathBuf>§gdb: Option<PathBuf>§lldb: Option<PathBuf>§python: Option<PathBuf>§reuse: Option<PathBuf>§cargo_native_static: bool§configure_args: Vec<String>§out: PathBuf§rust_info: GitInfo§cargo_info: GitInfo§rust_analyzer_info: GitInfo§clippy_info: GitInfo§miri_info: GitInfo§rustfmt_info: GitInfo§enzyme_info: GitInfo§in_tree_llvm_info: GitInfo§in_tree_gcc_info: GitInfo§initial_cargo: PathBuf§initial_rustc: PathBuf§initial_cargo_clippy: Option<PathBuf>§initial_rustfmt: RefCell<RustfmtState>§paths: Vec<PathBuf>

The paths to work with. For example: with ./x check foo bar we get paths=["foo", "bar"].

§compiletest_diff_tool: Option<String>

Command for visual diff display, e.g. diff-tool --color=always.

Implementations§

Source§

impl Config

Source

pub fn default_opts() -> Config

Source

pub(crate) fn get_builder_toml( &self, build_name: &str, ) -> Result<TomlConfig, Error>

Source

pub(crate) fn get_toml(file: &Path) -> Result<TomlConfig, Error>

Source

pub fn parse(flags: Flags) -> Config

Source

pub(crate) fn parse_inner( flags: Flags, get_toml: impl Fn(&Path) -> Result<TomlConfig, Error>, ) -> Config

Source

pub fn dry_run(&self) -> bool

Source

pub(crate) fn try_run(&self, cmd: &mut Command) -> Result<(), ()>

👎Deprecated: use Builder::try_run instead where possible

Runs a command, printing out nice contextual information if it fails. Exits if the command failed to execute at all, otherwise returns its status.success().

Source

pub(crate) fn test_args(&self) -> Vec<&str>

Source

pub(crate) fn args(&self) -> Vec<&str>

Source

pub(crate) fn read_file_by_commit(&self, file: &Path, commit: &str) -> String

Returns the content of the given file at a specific commit.

Source

pub(crate) fn artifact_version_part(&self, commit: &str) -> String

Bootstrap embeds a version number into the name of shared libraries it uploads in CI. Return the version it would have used for the given commit.

Source

pub fn bindir_relative(&self) -> &Path

Try to find the relative path of bindir, otherwise return it in full.

Source

pub fn libdir_relative(&self) -> Option<&Path>

Try to find the relative path of libdir.

Source

pub(crate) fn ci_llvm_root(&self) -> PathBuf

The absolute path to the downloaded LLVM artifacts.

Source

pub(crate) fn ci_rustc_dir(&self) -> PathBuf

Directory where the extracted rustc-dev component is stored.

Determine whether llvm should be linked dynamically.

If false, llvm should be linked statically. This is computed on demand since LLVM might have to first be downloaded from CI.

Source

pub(crate) fn download_rustc(&self) -> bool

Return whether we will use a downloaded, pre-compiled version of rustc, or just build from source.

Source

pub(crate) fn download_rustc_commit(&self) -> Option<&str>

Source

pub(crate) fn initial_rustfmt(&self) -> Option<PathBuf>

Source

pub fn verbose(&self, f: impl Fn())

Runs a function if verbosity is greater than 0

Source

pub fn sanitizers_enabled(&self, target: TargetSelection) -> bool

Source

pub fn needs_sanitizer_runtime_built(&self, target: TargetSelection) -> bool

Source

pub fn any_sanitizers_to_build(&self) -> bool

Source

pub fn profiler_path(&self, target: TargetSelection) -> Option<&str>

Source

pub fn profiler_enabled(&self, target: TargetSelection) -> bool

Source

pub fn any_profiler_enabled(&self) -> bool

Source

pub fn rpath_enabled(&self, target: TargetSelection) -> bool

Source

pub fn llvm_enabled(&self, target: TargetSelection) -> bool

Source

pub fn llvm_libunwind(&self, target: TargetSelection) -> LlvmLibunwind

Source

pub fn split_debuginfo(&self, target: TargetSelection) -> SplitDebuginfo

Source

pub fn submodules(&self) -> bool

Returns whether or not submodules should be managed by bootstrap.

Source

pub fn codegen_backends(&self, target: TargetSelection) -> &[String]

Source

pub fn default_codegen_backend(&self, target: TargetSelection) -> Option<String>

Source

pub fn git_config(&self) -> GitConfig<'_>

Source

pub(crate) fn update_submodule(&self, relative_path: &str)

Given a path to the directory of a submodule, update it.

relative_path should be relative to the root of the git repository, not an absolute path.

This does not update the submodule if config.toml explicitly says not to, or if we’re not in a git repository (like a plain source tarball). Typically crate::Build::require_submodule should be used instead to provide a nice error to the user if the submodule is missing.

Source

pub fn check_stage0_version( &self, program_path: &Path, component_name: &'static str, )

check rustc/cargo version is same or lower with 1 apart from the building one

Source

fn download_ci_rustc_commit( &self, download_rustc: Option<StringOrBool>, llvm_assertions: bool, ) -> Option<String>

Returns the commit to download, or None if we shouldn’t download CI artifacts.

Source

fn parse_download_ci_llvm( &self, download_ci_llvm: Option<StringOrBool>, asserts: bool, ) -> bool

Source

pub fn last_modified_commit( &self, modified_paths: &[&str], option_name: &str, if_unchanged: bool, ) -> Option<String>

Returns the last commit in which any of modified_paths were changed, or None if there are untracked changes in the working directory and if_unchanged is true.

Source§

impl Config

Generic helpers that are useful anywhere in bootstrap.

Source

pub fn is_verbose(&self) -> bool

Source

pub(crate) fn create(&self, path: &Path, s: &str)

Source

pub(crate) fn remove(&self, f: &Path)

Source

pub(crate) fn tempdir(&self) -> PathBuf

Create a temporary directory in out and return its path.

NOTE: this temporary directory is shared between all steps; if you need an empty directory, create a new subdirectory inside it.

Source

pub(crate) fn check_run(&self, cmd: &mut BootstrapCommand) -> bool

Runs a command, printing out nice contextual information if it fails. Returns false if do not execute at all, otherwise returns its status.success().

Source

fn should_fix_bins_and_dylibs(&self) -> bool

Whether or not fix_bin_or_dylib needs to be run; can only be true on NixOS

Source

fn fix_bin_or_dylib(&self, fname: &Path)

Modifies the interpreter section of ‘fname’ to fix the dynamic linker, or the RPATH section, to fix the dynamic library search path

This is only required on NixOS and uses the PatchELF utility to change the interpreter/RPATH of ELF executables.

Please see https://nixos.org/patchelf.html for more information

Source

fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str)

Source

fn download_http_with_retries( &self, tempfile: &Path, url: &str, help_on_error: &str, )

Source

fn unpack(&self, tarball: &Path, dst: &Path, pattern: &str)

Source

pub(crate) fn verify(&self, path: &Path, expected: &str) -> bool

Returns whether the SHA256 checksum of path matches expected.

Source§

impl Config

Functions that are only ever called once, but named for clarify and to avoid thousand-line functions.

Source

pub(crate) fn download_clippy(&self) -> PathBuf

Source

pub(crate) fn maybe_download_rustfmt(&self) -> Option<PathBuf>

NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can’t reuse target directories or artifacts

Source

pub(crate) fn ci_rust_std_contents(&self) -> Vec<String>

Source

pub(crate) fn ci_rustc_dev_contents(&self) -> Vec<String>

Source

fn ci_component_contents(&self, stamp_file: &str) -> Vec<String>

Source

pub(crate) fn download_ci_rustc(&self, commit: &str)

Source

pub(crate) fn download_beta_toolchain(&self)

Source

fn download_toolchain( &self, version: &str, sysroot: &str, stamp_key: &str, extra_components: &[&str], download_component: fn(_: &Config, _: String, _: &str, _: &str), )

Source

fn download_ci_component( &self, filename: String, prefix: &str, commit_with_assertions: &str, )

Download a single component of a CI-built toolchain (not necessarily a published nightly).

Source

fn download_component( &self, mode: DownloadSource, filename: String, prefix: &str, key: &str, destination: &str, )

Source

pub(crate) fn maybe_download_ci_llvm(&self)

Source

fn download_ci_llvm(&self, llvm_sha: &str)

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Config

Source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl !Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 2928 bytes