diff --git a/.github/ISSUE_TEMPLATE/bootstrap.md b/.github/ISSUE_TEMPLATE/bootstrap.md index 8d72eae8593..344ea30e1fc 100644 --- a/.github/ISSUE_TEMPLATE/bootstrap.md +++ b/.github/ISSUE_TEMPLATE/bootstrap.md @@ -32,7 +32,7 @@ Describe what you expected to happen. Describe what actually happened. --> -### Bootstrap configuration (config.toml) +### Bootstrap configuration (bootstrap.toml) ```toml ``` diff --git a/.gitignore b/.gitignore index b8cb31e8190..a549b6e6e56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # This file should only ignore things that are generated during a `x.py` build, # generated by common IDEs, and optional files controlled by the user that -# affect the build (such as config.toml). +# affect the build (such as bootstrap.toml). # In particular, things like `mir_dump` should not be listed here; they are only # created during manual debugging and many people like to clean up instead of # having git ignore such leftovers. You can use `.git/info/exclude` to @@ -34,6 +34,7 @@ Session.vim !/tests/run-make/thumb-none-qemu/example/.cargo ## Configuration +/bootstrap.toml /config.toml /Makefile config.mk diff --git a/.ignore b/.ignore index 40d1513978f..b0c640fee3d 100644 --- a/.ignore +++ b/.ignore @@ -1,2 +1,3 @@ -# Make vscode *not* count `config.toml` as ignored, so it is included in search +# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search +!/bootstrap.toml !/config.toml diff --git a/INSTALL.md b/INSTALL.md index a46d3d70093..30e08201d6d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.* The Rust build system uses a Python script called `x.py` to build the compiler, which manages the bootstrapping process. It lives at the root of the project. -It also uses a file named `config.toml` to determine various configuration +It also uses a file named `bootstrap.toml` to determine various configuration settings for the build. You can see a full list of options in -`config.example.toml`. +`bootstrap.example.toml`. The `x.py` command can be run directly on most Unix systems in the following format: @@ -115,7 +115,7 @@ See [the rustc-dev-guide for more info][sysllvm]. This project provides a configure script and makefile (the latter of which just invokes `x.py`). `./configure` is the recommended way to programmatically -generate a `config.toml`. `make` is not recommended (we suggest using `x.py` +generate a `bootstrap.toml`. `make` is not recommended (we suggest using `x.py` directly), but it is supported and we try not to break it unnecessarily. ```sh @@ -123,7 +123,7 @@ directly), but it is supported and we try not to break it unnecessarily. make && sudo make install ``` -`configure` generates a `config.toml` which can also be used with normal `x.py` +`configure` generates a `bootstrap.toml` which can also be used with normal `x.py` invocations. ## Building on Windows @@ -255,7 +255,7 @@ Windows build triples are: - `x86_64-pc-windows-msvc` The build triple can be specified by either specifying `--build=` when -invoking `x.py` commands, or by creating a `config.toml` file (as described in +invoking `x.py` commands, or by creating a `bootstrap.toml` file (as described in [Building on a Unix-like system](#building-on-a-unix-like-system)), and passing `--set build.build=` to `./configure`. diff --git a/RELEASES.md b/RELEASES.md index 038d7ca639f..381b9ebc952 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2282,7 +2282,7 @@ Compatibility Notes - [Cargo denies `CARGO_HOME` in the `[env]` configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended.](https://github.com/rust-lang/cargo/pull/11644/) - [Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.](https://github.com/rust-lang/cargo/pull/11252/) - [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886) - If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By + If `tools = [...]` is set in bootstrap.toml, we will respect a missing rustdoc in that list. By default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the list. @@ -5268,7 +5268,7 @@ related tools. - [Building `rustc` from source now uses `ninja` by default over `make`.][74922] You can continue building with `make` by setting `ninja=false` in - your `config.toml`. + your `bootstrap.toml`. - [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030] - [Made `ensure_sufficient_stack()` non-generic][76680] diff --git a/REUSE.toml b/REUSE.toml index 9e873e94eff..816c6d730c8 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -22,7 +22,7 @@ path = [ "Cargo.lock", "Cargo.toml", "CODE_OF_CONDUCT.md", - "config.example.toml", + "bootstrap.example.toml", "configure", "CONTRIBUTING.md", "COPYRIGHT", diff --git a/config.example.toml b/bootstrap.example.toml similarity index 99% rename from config.example.toml rename to bootstrap.example.toml index 0700a317109..294d9780716 100644 --- a/config.example.toml +++ b/bootstrap.example.toml @@ -5,7 +5,7 @@ # # All options are commented out by default in this file, and they're commented # out with their default values. The build system by default looks for -# `config.toml` in the current directory of a build for build configuration, but +# `bootstrap.toml` in the current directory of a build for build configuration, but # a custom configuration file can also be specified with `--config` to the build # system. @@ -16,7 +16,7 @@ # Use different pre-set defaults than the global defaults. # # See `src/bootstrap/defaults` for more information. -# Note that this has no default value (x.py uses the defaults in `config.example.toml`). +# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`). #profile = # Keeps track of major changes made to this configuration. @@ -346,7 +346,7 @@ # Enable a build of the extended Rust tool set which is not only the compiler # but also tools such as Cargo. This will also produce "combined installers" # which are used to install Rust and Cargo together. -# The `tools` (check `config.example.toml` to see its default value) option specifies +# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies # which tools should be built if `extended = true`. # # This is disabled by default. diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md index f036603ee70..f9d7c811f60 100644 --- a/src/bootstrap/README.md +++ b/src/bootstrap/README.md @@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust. Because there are two separate codebases behind `x.py`, they need to be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary -parse `config.toml` and read the same command line arguments. `bootstrap.py` +parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py` keeps these in sync by setting various environment variables, and the programs sometimes have to add arguments that are explicitly ignored, to be read by the other. diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 01a9792f1b3..68400ba0ea0 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -726,7 +726,7 @@ class RustBuild(object): def should_fix_bins_and_dylibs(self): """Whether or not `fix_bin_or_dylib` needs to be run; can only be True - on NixOS or if config.toml has `build.patch-binaries-for-nix` set. + on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set. """ if self._should_fix_bins_and_dylibs is not None: return self._should_fix_bins_and_dylibs @@ -775,7 +775,7 @@ class RustBuild(object): "The IN_NIX_SHELL environment variable is `{}`;".format( in_nix_shell ), - "you may need to set `patch-binaries-for-nix=true` in config.toml", + "you may need to set `patch-binaries-for-nix=true` in bootstrap.toml", ) return is_nixos @@ -884,7 +884,7 @@ class RustBuild(object): return os.path.join(self.build_dir, self.build, subdir) def get_toml(self, key, section=None): - """Returns the value of the given key in config.toml, otherwise returns None + """Returns the value of the given key in bootstrap.toml, otherwise returns None >>> rb = RustBuild() >>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"' @@ -1250,17 +1250,23 @@ def bootstrap(args): "unless you put them in place manually." ) - # Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`, - # then `config.toml` in the root directory. + # Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`. + # If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory. + # If those are unavailable, fall back to `./config.toml`, then `config.toml` for + # backward compatibility. toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG") using_default_path = toml_path is None if using_default_path: - toml_path = "config.toml" + toml_path = "bootstrap.toml" if not os.path.exists(toml_path): - toml_path = os.path.join(rust_root, toml_path) + toml_path = os.path.join(rust_root, "bootstrap.toml") + if not os.path.exists(toml_path): + toml_path = "config.toml" + if not os.path.exists(toml_path): + toml_path = os.path.join(rust_root, "config.toml") # Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path, - # but not if `config.toml` hasn't been created. + # but not if `bootstrap.toml` hasn't been created. if not using_default_path or os.path.exists(toml_path): with open(toml_path) as config: config_toml = config.read() @@ -1278,7 +1284,9 @@ def bootstrap(args): # profiles to be renamed while maintaining back compatibility # Keep in sync with `profile_aliases` in config.rs profile_aliases = {"user": "dist"} - include_file = "config.{}.toml".format(profile_aliases.get(profile) or profile) + include_file = "bootstrap.{}.toml".format( + profile_aliases.get(profile) or profile + ) include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults") include_path = os.path.join(include_dir, include_file) diff --git a/src/bootstrap/bootstrap_test.py b/src/bootstrap/bootstrap_test.py index 7494536539d..9e12982a43d 100644 --- a/src/bootstrap/bootstrap_test.py +++ b/src/bootstrap/bootstrap_test.py @@ -156,7 +156,7 @@ class ParseArgsInConfigure(unittest.TestCase): class GenerateAndParseConfig(unittest.TestCase): - """Test that we can serialize and deserialize a config.toml file""" + """Test that we can serialize and deserialize a bootstrap.toml file""" def test_no_args(self): build = serialize_and_parse([]) @@ -206,11 +206,11 @@ class BuildBootstrap(unittest.TestCase): # problem in most cases, but there is a scenario where it would cause # the test to fail. # - # When a custom local Cargo is configured in config.toml (with the + # When a custom local Cargo is configured in bootstrap.toml (with the # build.cargo setting), no Cargo is downloaded to any location known by # bootstrap, and bootstrap relies on that setting to find it. # - # In this test though we are not using the config.toml of the caller: + # In this test though we are not using the bootstrap.toml of the caller: # we are generating a blank one instead. If we don't set build.cargo in # it, the test will have no way to find Cargo, failing the test. cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN") diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 77151edd240..f6afe096724 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -367,8 +367,8 @@ if "--help" in sys.argv or "-h" in sys.argv: print("\t\t" + option.desc) print("") print("This configure script is a thin configuration shim over the true") - print("configuration system, `config.toml`. You can explore the comments") - print("in `config.example.toml` next to this configure script to see") + print("configuration system, `bootstrap.toml`. You can explore the comments") + print("in `bootstrap.example.toml` next to this configure script to see") print("more information about what each option is. Additionally you can") print("pass `--set` as an argument to set arbitrary key/value pairs") print("in the TOML configuration if desired") @@ -567,8 +567,8 @@ def apply_args(known_args, option_checking, config): raise RuntimeError("unhandled option {}".format(option.name)) -# "Parse" the `config.example.toml` file into the various sections, and we'll -# use this as a template of a `config.toml` to write out which preserves +# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll +# use this as a template of a `bootstrap.toml` to write out which preserves # all the various comments and whatnot. # # Note that the `target` section is handled separately as we'll duplicate it @@ -581,7 +581,7 @@ def parse_example_config(known_args, config): targets = {} top_level_keys = [] - with open(rust_dir + "/config.example.toml") as example_config: + with open(rust_dir + "/bootstrap.example.toml") as example_config: example_lines = example_config.read().split("\n") for line in example_lines: if cur_section is None: @@ -755,8 +755,8 @@ def quit_if_file_exists(file): if __name__ == "__main__": - # If 'config.toml' already exists, exit the script at this point - quit_if_file_exists("config.toml") + # If 'bootstrap.toml' already exists, exit the script at this point + quit_if_file_exists("bootstrap.toml") if "GITHUB_ACTIONS" in os.environ: print("::group::Configure the build") @@ -766,11 +766,11 @@ if __name__ == "__main__": p("") section_order, sections, targets = parse_args(sys.argv[1:]) - # Now that we've built up our `config.toml`, write it all out in the same + # Now that we've built up our `bootstrap.toml`, write it all out in the same # order that we read it in. p("") - p("writing `config.toml` in current directory") - with bootstrap.output("config.toml") as f: + p("writing `bootstrap.toml` in current directory") + with bootstrap.output("bootstrap.toml") as f: write_config_toml(f, section_order, targets, sections) with bootstrap.output("Makefile") as f: diff --git a/src/bootstrap/defaults/config.compiler.toml b/src/bootstrap/defaults/bootstrap.compiler.toml similarity index 100% rename from src/bootstrap/defaults/config.compiler.toml rename to src/bootstrap/defaults/bootstrap.compiler.toml diff --git a/src/bootstrap/defaults/config.dist.toml b/src/bootstrap/defaults/bootstrap.dist.toml similarity index 100% rename from src/bootstrap/defaults/config.dist.toml rename to src/bootstrap/defaults/bootstrap.dist.toml diff --git a/src/bootstrap/defaults/config.library.toml b/src/bootstrap/defaults/bootstrap.library.toml similarity index 100% rename from src/bootstrap/defaults/config.library.toml rename to src/bootstrap/defaults/bootstrap.library.toml diff --git a/src/bootstrap/defaults/config.tools.toml b/src/bootstrap/defaults/bootstrap.tools.toml similarity index 100% rename from src/bootstrap/defaults/config.tools.toml rename to src/bootstrap/defaults/bootstrap.tools.toml diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 6f6aaa878ef..88c2d8d9968 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -77,14 +77,14 @@ fn main() { check_version(&config) }; - // NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the + // NOTE: Since `./configure` generates a `bootstrap.toml`, distro maintainers will see the // changelog warning, not the `x.py setup` message. let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. }); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); + println!("WARNING: you have not made a `bootstrap.toml`"); println!( - "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ - `cp config.example.toml config.toml`" + "HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \ + `cp bootstrap.example.toml bootstrap.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { println!("{suggestion}"); @@ -98,10 +98,10 @@ fn main() { Build::new(config).build(); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); + println!("WARNING: you have not made a `bootstrap.toml`"); println!( - "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ - `cp config.example.toml config.toml`" + "HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \ + `cp bootstrap.example.toml bootstrap.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { println!("{suggestion}"); @@ -160,7 +160,7 @@ fn check_version(config: &Config) -> Option { } // Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist, - // then use the one from the config.toml. This way we never show the same warnings + // then use the one from the bootstrap.toml. This way we never show the same warnings // more than once. if let Ok(t) = fs::read_to_string(&warned_id_path) { let last_warned_id = usize::from_str(&t) @@ -185,16 +185,18 @@ fn check_version(config: &Config) -> Option { msg.push_str("NOTE: to silence this warning, "); msg.push_str(&format!( - "update `config.toml` to use `change-id = {latest_change_id}` instead" + "update `bootstrap.toml` to use `change-id = {latest_change_id}` instead" )); if io::stdout().is_terminal() { t!(fs::write(warned_id_path, latest_change_id.to_string())); } } else { - msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n"); + msg.push_str("WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n"); msg.push_str("NOTE: to silence this warning, "); - msg.push_str(&format!("add `change-id = {latest_change_id}` at the top of `config.toml`")); + msg.push_str(&format!( + "add `change-id = {latest_change_id}` at the top of `bootstrap.toml`" + )); }; Some(msg) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 7c83c53d2c2..846b4de8142 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -425,7 +425,7 @@ fn copy_self_contained_objects( } else if target.contains("-wasi") { let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| { panic!( - "Target {:?} does not have a \"wasi-root\" key in Config.toml \ + "Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \ or `$WASI_SDK_PATH` set", target.triple ) @@ -1294,7 +1294,7 @@ pub fn rustc_cargo_env( .env("CFG_VERSION", builder.rust_version()); // Some tools like Cargo detect their own git information in build scripts. When omit-git-hash - // is enabled in config.toml, we pass this environment variable to tell build scripts to avoid + // is enabled in bootstrap.toml, we pass this environment variable to tell build scripts to avoid // detecting git information on their own. if builder.config.omit_git_hash { cargo.env("CFG_OMIT_GIT_HASH", "1"); @@ -1538,7 +1538,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { { run.builder.info( "WARNING: no codegen-backends config matched the requested path to build a codegen backend. \ - HELP: add backend to codegen-backends in config.toml.", + HELP: add backend to codegen-backends in bootstrap.toml.", ); return true; } @@ -1550,7 +1550,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { impl Step for CodegenBackend { type Output = (); const ONLY_HOSTS: bool = true; - /// Only the backends specified in the `codegen-backends` entry of `config.toml` are built. + /// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built. const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index ffb60bd5634..0515a4cc00e 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1000,9 +1000,9 @@ impl Step for PlainSourceTarball { let src_files = [ // tidy-alphabetical-start ".gitmodules", + "bootstrap.example.toml", "Cargo.lock", "Cargo.toml", - "config.example.toml", "configure", "CONTRIBUTING.md", "COPYRIGHT", diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 8e913f68184..a8da4146100 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -1218,7 +1218,7 @@ impl Step for RustcBook { cmd.env("RUSTC_BOOTSTRAP", "1"); // If the lib directories are in an unusual location (changed in - // config.toml), then this needs to explicitly update the dylib search + // bootstrap.toml), then this needs to explicitly update the dylib search // path. builder.add_rustc_lib_path(self.compiler, &mut cmd); let doc_generator_guard = builder.msg( diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 4f96d67a5bd..3e5069225d2 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -85,11 +85,11 @@ fn install_sh( } else { assert!( is_dir_writable_for_user(&prefix), - "User doesn't have write access on `install.prefix` path in the `config.toml`.", + "User doesn't have write access on `install.prefix` path in the `bootstrap.toml`.", ); assert!( is_dir_writable_for_user(&sysconfdir), - "User doesn't have write access on `install.sysconfdir` path in `config.toml`." + "User doesn't have write access on `install.sysconfdir` path in `bootstrap.toml`." ); } diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 3b6b7cb2055..1e3148d631c 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -350,7 +350,7 @@ impl Step for Llvm { (true, true) => "RelWithDebInfo", }; - // NOTE: remember to also update `config.example.toml` when changing the + // NOTE: remember to also update `bootstrap.example.toml` when changing the // defaults! let llvm_targets = match &builder.config.llvm_targets { Some(s) => s, diff --git a/src/bootstrap/src/core/build_steps/perf.rs b/src/bootstrap/src/core/build_steps/perf.rs index 6962001fdc2..7f4e88bd73c 100644 --- a/src/bootstrap/src/core/build_steps/perf.rs +++ b/src/bootstrap/src/core/build_steps/perf.rs @@ -147,7 +147,7 @@ pub fn perf(builder: &Builder<'_>, args: &PerfArgs) { }; if is_profiling && builder.build.config.rust_debuginfo_level_rustc == DebuginfoLevel::None { builder.info(r#"WARNING: You are compiling rustc without debuginfo, this will make profiling less useful. -Consider setting `rust.debuginfo-level = 1` in `config.toml`."#); +Consider setting `rust.debuginfo-level = 1` in `bootstrap.toml`."#); } let compiler = builder.compiler(builder.top_stage, builder.config.build); diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs index 1ef86e674f0..5cacd5b9914 100644 --- a/src/bootstrap/src/core/build_steps/run.rs +++ b/src/bootstrap/src/core/build_steps/run.rs @@ -35,10 +35,10 @@ impl Step for BuildManifest { // (https://github.com/rust-lang/promote-release). let mut cmd = builder.tool_cmd(Tool::BuildManifest); let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| { - panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n") + panic!("\n\nfailed to specify `dist.sign-folder` in `bootstrap.toml`\n\n") }); let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| { - panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n") + panic!("\n\nfailed to specify `dist.upload-addr` in `bootstrap.toml`\n\n") }); let today = command("date").arg("+%Y-%m-%d").run_capture_stdout(builder).stdout(); diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 45f9f52cb82..636d51e0e90 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -2,8 +2,8 @@ //! //! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory //! for modifying, building, and running the compiler and library. Running arbitrary configuration -//! allows setting up things that cannot be simply captured inside the config.toml, in addition to -//! leading people away from manually editing most of the config.toml values. +//! allows setting up things that cannot be simply captured inside the bootstrap.toml, in addition to +//! leading people away from manually editing most of the bootstrap.toml values. use std::env::consts::EXE_SUFFIX; use std::fmt::Write as _; @@ -37,7 +37,7 @@ static PROFILE_DIR: &str = "src/bootstrap/defaults"; impl Profile { fn include_path(&self, src_path: &Path) -> PathBuf { - PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self)) + PathBuf::from(format!("{}/{PROFILE_DIR}/bootstrap.{}.toml", src_path.display(), self)) } pub fn all() -> impl Iterator { @@ -53,7 +53,7 @@ impl Profile { Compiler => "Contribute to the compiler itself", Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)", Dist => "Install Rust from source", - None => "Do not modify `config.toml`" + None => "Do not modify `bootstrap.toml`" } .to_string() } @@ -117,7 +117,7 @@ impl Step for Profile { return; } - let path = &run.builder.config.config.clone().unwrap_or(PathBuf::from("config.toml")); + let path = &run.builder.config.config.clone().unwrap_or(PathBuf::from("bootstrap.toml")); if path.exists() { eprintln!(); eprintln!( @@ -203,7 +203,7 @@ pub fn setup(config: &Config, profile: Profile) { ) } - let path = &config.config.clone().unwrap_or(PathBuf::from("config.toml")); + let path = &config.config.clone().unwrap_or(PathBuf::from("bootstrap.toml")); setup_config_toml(path, profile, config); } diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index cff286e99fa..81f6b473c45 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1119,7 +1119,7 @@ impl Step for Tidy { "\ ERROR: no `rustfmt` binary found in {PATH} INFO: `rust.channel` is currently set to \"{CHAN}\" -HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file +HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `bootstrap.toml` file HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`", PATH = inferred_rustfmt_dir.display(), CHAN = builder.config.channel, diff --git a/src/bootstrap/src/core/build_steps/toolstate.rs b/src/bootstrap/src/core/build_steps/toolstate.rs index a65623de95a..fc7acd1fa14 100644 --- a/src/bootstrap/src/core/build_steps/toolstate.rs +++ b/src/bootstrap/src/core/build_steps/toolstate.rs @@ -128,7 +128,7 @@ impl Step for ToolStateCheck { /// Checks tool state status. /// /// This is intended to be used in the `checktools.sh` script. To use - /// this, set `save-toolstates` in `config.toml` so that tool status will + /// this, set `save-toolstates` in `bootstrap.toml` so that tool status will /// be saved to a JSON file. Then, run `x.py test --no-fail-fast` for all /// of the tools to populate the JSON file. After that is done, this /// command can be run to check for any status failures, and exits with an @@ -254,7 +254,7 @@ impl Builder<'_> { /// Updates the actual toolstate of a tool. /// /// The toolstates are saved to the file specified by the key - /// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be + /// `rust.save-toolstates` in `bootstrap.toml`. If unspecified, nothing will be /// done. The file is updated immediately after this function completes. pub fn save_toolstate(&self, tool: &str, state: ToolState) { use std::io::Write; diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 62d23c4ae6b..efb1b8b25b7 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -215,7 +215,7 @@ impl Cargo { // dynamic libraries. We use this by default on Unix platforms to ensure // that our nightlies behave the same on Windows, that is they work out // of the box. This can be disabled by setting `rpath = false` in `[rust]` - // table of `config.toml` + // table of `bootstrap.toml` // // Ok, so the astute might be wondering "why isn't `-C rpath` used // here?" and that is indeed a good question to ask. This codegen diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 0b6b8513cc3..a9058f888d3 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -31,9 +31,9 @@ mod cargo; mod tests; /// Builds and performs different [`Self::kind`]s of stuff and actions, taking -/// into account build configuration from e.g. config.toml. +/// into account build configuration from e.g. bootstrap.toml. pub struct Builder<'a> { - /// Build configuration from e.g. config.toml. + /// Build configuration from e.g. bootstrap.toml. pub build: &'a Build, /// The stage to use. Either implicitly determined based on subcommand, or @@ -332,7 +332,7 @@ impl PathSet { } const PATH_REMAP: &[(&str, &[&str])] = &[ - // config.toml uses `rust-analyzer-proc-macro-srv`, but the + // bootstrap.toml uses `rust-analyzer-proc-macro-srv`, but the // actual path is `proc-macro-srv-cli` ("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]), // Make `x test tests` function the same as `x t tests/*` diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 18624a7c78f..f8ed8072c3d 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1,6 +1,6 @@ //! Serialized configuration of a build. //! -//! This module implements parsing `config.toml` configuration files to tweak +//! This module implements parsing `bootstrap.toml` configuration files to tweak //! how the build runs. use std::cell::{Cell, RefCell}; @@ -64,7 +64,7 @@ macro_rules! check_ci_llvm { /// useful in scenarios where developers want to see how the tarball sources were /// generated. /// -/// We also use this file to compare the host's config.toml against the CI rustc builder +/// We also use this file to compare the host's bootstrap.toml against the CI rustc builder /// configuration to detect any incompatible options. pub(crate) const BUILDER_CONFIG_FILENAME: &str = "builder-config"; @@ -184,12 +184,12 @@ pub enum GccCiMode { /// 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. +/// This structure is parsed from `bootstrap.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`. +/// `bootstrap.example.toml`. #[derive(Default, Clone)] pub struct Config { pub change_id: Option, @@ -235,7 +235,7 @@ pub struct Config { pub keep_stage: Vec, pub keep_stage_std: Vec, pub src: PathBuf, - /// defaults to `config.toml` + /// defaults to `bootstrap.toml` pub config: Option, pub jobs: Option, pub cmd: Subcommand, @@ -470,7 +470,7 @@ impl std::str::FromStr for SplitDebuginfo { impl SplitDebuginfo { /// Returns the default `-Csplit-debuginfo` value for the current target. See the comment for - /// `rust.split-debuginfo` in `config.example.toml`. + /// `rust.split-debuginfo` in `bootstrap.example.toml`. fn default_for_platform(target: TargetSelection) -> Self { if target.contains("apple") { SplitDebuginfo::Unpacked @@ -677,7 +677,7 @@ impl Target { target } } -/// Structure of the `config.toml` file that configuration is read from. +/// Structure of the `bootstrap.toml` file that configuration is read from. /// /// This structure uses `Decodable` to automatically decode a TOML configuration /// file into this format, and then this is traversed and written into the above @@ -1485,26 +1485,35 @@ impl Config { config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file(); - // Find configuration file, with the following cascading fallback (first match wins): - // - `--config ` - // - `RUST_BOOTSTRAP_CONFIG` - // - `./config.toml` - // - `config.toml` in the root directory. + // Locate the configuration file using the following priority (first match wins): + // 1. `--config ` (explicit flag) + // 2. `RUST_BOOTSTRAP_CONFIG` environment variable + // 3. `./bootstrap.toml` (local file) + // 4. `/bootstrap.toml` + // 5. `./config.toml` (fallback for backward compatibility) + // 6. `/config.toml` let toml_path = flags .config .clone() .or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from)); let using_default_path = toml_path.is_none(); - let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("config.toml")); + let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml")); + if using_default_path && !toml_path.exists() { - toml_path = config.src.join(toml_path); + toml_path = config.src.join(PathBuf::from("bootstrap.toml")); + if !toml_path.exists() { + toml_path = PathBuf::from("config.toml"); + if !toml_path.exists() { + toml_path = config.src.join(PathBuf::from("config.toml")); + } + } } let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel"))); let ci_channel = file_content.trim_end(); // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path, - // but not if `config.toml` hasn't been created. + // but not if `bootstrap.toml` hasn't been created. let mut toml = if !using_default_path || toml_path.exists() { config.config = Some(if cfg!(not(test)) { toml_path.canonicalize().unwrap() @@ -1525,7 +1534,7 @@ impl Config { // same ones used to call the tests (if custom ones are not defined in the toml). If we // don't do that, bootstrap will use its own detection logic to find a suitable rustc // and Cargo, which doesn't work when the caller is specìfying a custom local rustc or - // Cargo in their config.toml. + // Cargo in their bootstrap.toml. let build = toml.build.get_or_insert_with(Default::default); build.rustc = build.rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into())); build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into())); @@ -1548,7 +1557,7 @@ impl Config { include_path.push("src"); include_path.push("bootstrap"); include_path.push("defaults"); - include_path.push(format!("config.{include}.toml")); + include_path.push(format!("bootstrap.{include}.toml")); let included_toml = get_toml(&include_path).unwrap_or_else(|e| { eprintln!( "ERROR: Failed to parse default config profile at '{}': {e}", @@ -2030,7 +2039,7 @@ impl Config { config.description = description; // We need to override `rust.channel` if it's manually specified when using the CI rustc. - // This is because if the compiler uses a different channel than the one specified in config.toml, + // This is because if the compiler uses a different channel than the one specified in bootstrap.toml, // tests may fail due to using a different channel than the one used by the compiler during tests. if let Some(commit) = &config.download_rustc_commit { if is_user_configured_rust_channel { @@ -2655,7 +2664,7 @@ impl Config { return None; }, Err(e) => { - eprintln!("ERROR: Failed to parse CI rustc config.toml: {e}"); + eprintln!("ERROR: Failed to parse CI rustc bootstrap.toml: {e}"); exit!(2); }, }; @@ -2818,7 +2827,7 @@ impl Config { /// /// `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 + /// This *does not* update the submodule if `bootstrap.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 @@ -3042,7 +3051,9 @@ impl Config { } println!("ERROR: could not find commit hash for downloading rustc"); println!("HELP: maybe your repository history is too shallow?"); - println!("HELP: consider setting `rust.download-rustc=false` in config.toml"); + println!( + "HELP: consider setting `rust.download-rustc=false` in bootstrap.toml" + ); println!("HELP: or fetch enough history to include one upstream commit"); crate::exit!(1); } diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index 3bb62bbe380..0f8efcfcc76 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -54,7 +54,7 @@ pub struct Flags { /// TOML configuration file for build pub config: Option, #[arg(global = true, long, value_hint = clap::ValueHint::DirPath, value_name = "DIR")] - /// Build directory, overrides `build.build-dir` in `config.toml` + /// Build directory, overrides `build.build-dir` in `bootstrap.toml` pub build_dir: Option, #[arg(global = true, long, value_hint = clap::ValueHint::Other, value_name = "BUILD")] @@ -173,7 +173,7 @@ pub struct Flags { #[arg(global = true)] /// paths for the subcommand pub paths: Vec, - /// override options in config.toml + /// override options in bootstrap.toml #[arg(global = true, value_hint = clap::ValueHint::Other, long, value_name = "section.option=value")] pub set: Vec, /// arguments passed to subcommands @@ -448,7 +448,7 @@ pub enum Subcommand { /// Set up the environment for development #[command(long_about = format!( "\n -x.py setup creates a `config.toml` which changes the defaults for x.py itself, +x.py setup creates a `bootstrap.toml` which changes the defaults for x.py itself, as well as setting up a git pre-push hook, VS Code config and toolchain link. Arguments: This subcommand accepts a 'profile' to use for builds. For example: @@ -461,7 +461,7 @@ Arguments: ./x.py setup editor ./x.py setup link", Profile::all_for_help(" ").trim_end()))] Setup { - /// Either the profile for `config.toml` or another setup action. + /// Either the profile for `bootstrap.toml` or another setup action. /// May be omitted to set up interactively #[arg(value_name = "|hook|editor|link")] profile: Option, diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index c7b6f3681b8..c5c77d19f07 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -69,7 +69,7 @@ fn detect_src_and_out() { let expected_src = manifest_dir.ancestors().nth(2).unwrap(); assert_eq!(&cfg.src, expected_src); - // test if build-dir was manually given in config.toml + // test if build-dir was manually given in bootstrap.toml if let Some(custom_build_dir) = build_dir { assert_eq!(&cfg.out, Path::new(custom_build_dir)); } @@ -230,7 +230,7 @@ fn override_toml_duplicate() { fn profile_user_dist() { fn get_toml(file: &Path) -> Result { let contents = - if file.ends_with("config.toml") || env::var_os("RUST_BOOTSTRAP_CONFIG").is_some() { + if file.ends_with("bootstrap.toml") || env::var_os("RUST_BOOTSTRAP_CONFIG").is_some() { "profile = \"user\"".to_owned() } else { assert!(file.ends_with("config.dist.toml")); @@ -402,7 +402,7 @@ fn jobs_precedence() { ); assert_eq!(config.jobs, Some(67890)); - // `--set build.jobs` should take precedence over `config.toml`. + // `--set build.jobs` should take precedence over `bootstrap.toml`. let config = Config::parse_inner( Flags::parse(&[ "check".to_owned(), @@ -420,7 +420,7 @@ fn jobs_precedence() { ); assert_eq!(config.jobs, Some(12345)); - // `--jobs` > `--set build.jobs` > `config.toml` + // `--jobs` > `--set build.jobs` > `bootstrap.toml` let config = Config::parse_inner( Flags::parse(&[ "check".to_owned(), diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index 98eff664a5b..b99d2e4631a 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -124,7 +124,7 @@ impl Config { if let Ok(in_nix_shell) = in_nix_shell { eprintln!( "The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \ - you may need to set `patch-binaries-for-nix=true` in config.toml" + you may need to set `patch-binaries-for-nix=true` in bootstrap.toml" ); } } @@ -699,7 +699,7 @@ impl Config { help_on_error = "ERROR: failed to download pre-built rustc from CI NOTE: old builds get deleted after a certain time -HELP: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml: +HELP: if trying to compile an old commit of rustc, disable `download-rustc` in bootstrap.toml: [rust] download-rustc = false @@ -783,7 +783,7 @@ download-rustc = false println!("HELP: Consider rebasing to a newer commit if available."); } Err(e) => { - eprintln!("ERROR: Failed to parse CI LLVM config.toml: {e}"); + eprintln!("ERROR: Failed to parse CI LLVM bootstrap.toml: {e}"); exit!(2); } }; @@ -816,7 +816,7 @@ download-rustc = false HELP: There could be two reasons behind this: 1) The host triple is not supported for `download-ci-llvm`. 2) Old builds get deleted after a certain time. - HELP: In either case, disable `download-ci-llvm` in your config.toml: + HELP: In either case, disable `download-ci-llvm` in your bootstrap.toml: [llvm] download-ci-llvm = false diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 583b8e1198a..dbfebd11f82 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -153,7 +153,7 @@ pub fn check(build: &mut Build) { Couldn't find required command: cmake You should install cmake, or set `download-ci-llvm = true` in the -`[llvm]` section of `config.toml` to download LLVM rather +`[llvm]` section of `bootstrap.toml` to download LLVM rather than building it. " ); @@ -339,7 +339,7 @@ than building it. None => panic!( "when targeting MUSL either the rust.musl-root \ option or the target.$TARGET.musl-root option must \ - be specified in config.toml" + be specified in bootstrap.toml" ), } } diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 91574f8bf5d..1fba17dcf30 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -143,7 +143,7 @@ pub enum GitRepo { /// organize). #[derive(Clone)] pub struct Build { - /// User-specified configuration from `config.toml`. + /// User-specified configuration from `bootstrap.toml`. config: Config, // Version information @@ -538,7 +538,7 @@ impl Build { /// This avoids contributors checking in a submodule change by accident. fn update_existing_submodules(&self) { // Avoid running git when there isn't a git checkout, or the user has - // explicitly disabled submodules in `config.toml`. + // explicitly disabled submodules in `bootstrap.toml`. if !self.config.submodules() { return; } @@ -671,7 +671,7 @@ impl Build { } /// Gets the space-separated set of activated features for the standard library. - /// This can be configured with the `std-features` key in config.toml. + /// This can be configured with the `std-features` key in bootstrap.toml. fn std_features(&self, target: TargetSelection) -> String { let mut features: BTreeSet<&str> = self.config.rust_std_features.iter().map(|s| s.as_str()).collect(); @@ -1925,7 +1925,7 @@ Couldn't find required command: ninja (or ninja-build) You should install ninja as described at , -or set `ninja = false` in the `[llvm]` section of `config.toml`. +or set `ninja = false` in the `[llvm]` section of `bootstrap.toml`. Alternatively, set `download-ci-llvm = true` in that `[llvm]` section to download LLVM rather than building it. " diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 1e84a7deff1..355a4899100 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -4,8 +4,8 @@ //! C and C++ compilers for each target configured. A compiler is found through //! a number of vectors (in order of precedence) //! -//! 1. Configuration via `target.$target.cc` in `config.toml`. -//! 2. Configuration via `target.$target.android-ndk` in `config.toml`, if +//! 1. Configuration via `target.$target.cc` in `bootstrap.toml`. +//! 2. Configuration via `target.$target.android-ndk` in `bootstrap.toml`, if //! applicable //! 3. Special logic to probe on OpenBSD //! 4. The `CC_$target` environment variable. @@ -195,7 +195,7 @@ fn default_compiler( ) -> Option { match &*target.triple { // When compiling for android we may have the NDK configured in the - // config.toml in which case we look there. Otherwise the default + // bootstrap.toml in which case we look there. Otherwise the default // compiler already takes into account the triple in question. t if t.contains("android") => { build.config.android_ndk.as_ref().map(|ndk| ndk_compiler(compiler, &target.triple, ndk)) diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index f8478725c4c..e585767ac77 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -385,4 +385,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Info, summary: "New option `build.exclude` that adds support for excluding test.", }, + ChangeInfo { + change_id: 137081, + severity: ChangeSeverity::Info, + summary: "The default configuration filename has changed from `config.toml` to `bootstrap.toml`. `config.toml` is deprecated but remains supported for backward compatibility.", + }, ]; diff --git a/triagebot.toml b/triagebot.toml index 293ad259910..626ae64ee4e 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -421,7 +421,7 @@ trigger_files = [ trigger_files = [ "Cargo.toml", "configure", - "config.example.toml", + "bootstrap.example.toml", "src/bootstrap", "src/build_helper", "src/tools/rust-installer",