Skip to content

Commit 8279176

Browse files
committed
Auto merge of #137081 - Shourya742:2025-02-15-change-config.toml-to-bootstrap.toml, r=onur-ozkan,jieyouxu,kobzol
change config.toml to bootstrap.toml Currently, both Bootstrap and Cargo uses same name as their configuration file, which can be confusing. This PR is based on a discussion to rename `config.toml` to `bootstrap.toml` for Bootstrap. Closes: #126875. I have split the PR into atomic commits to make it easier to review. Once the changes are finalized, I will squash them. I am particularly concerned about the changes made to modules that are not part of Bootstrap. How should we handle those changes? Should we ping the respective maintainers?
2 parents 9c67cec + 4579615 commit 8279176

File tree

125 files changed

+570
-532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+570
-532
lines changed

‎.github/ISSUE_TEMPLATE/bootstrap.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Describe what you expected to happen.
3232
Describe what actually happened.
3333
-->
3434

35-
### Bootstrap configuration (config.toml)
35+
### Bootstrap configuration (bootstrap.toml)
3636
```toml
3737
<config>
3838
```

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file should only ignore things that are generated during a `x.py` build,
22
# generated by common IDEs, and optional files controlled by the user that
3-
# affect the build (such as config.toml).
3+
# affect the build (such as bootstrap.toml).
44
# In particular, things like `mir_dump` should not be listed here; they are only
55
# created during manual debugging and many people like to clean up instead of
66
# having git ignore such leftovers. You can use `.git/info/exclude` to
@@ -34,6 +34,7 @@ Session.vim
3434
!/tests/run-make/thumb-none-qemu/example/.cargo
3535

3636
## Configuration
37+
/bootstrap.toml
3738
/config.toml
3839
/Makefile
3940
config.mk

‎.ignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Make vscode *not* count `config.toml` as ignored, so it is included in search
1+
# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search
2+
!/bootstrap.toml
23
!/config.toml

‎INSTALL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.*
66

77
The Rust build system uses a Python script called `x.py` to build the compiler,
88
which manages the bootstrapping process. It lives at the root of the project.
9-
It also uses a file named `config.toml` to determine various configuration
9+
It also uses a file named `bootstrap.toml` to determine various configuration
1010
settings for the build. You can see a full list of options in
11-
`config.example.toml`.
11+
`bootstrap.example.toml`.
1212

1313
The `x.py` command can be run directly on most Unix systems in the following
1414
format:
@@ -115,15 +115,15 @@ See [the rustc-dev-guide for more info][sysllvm].
115115

116116
This project provides a configure script and makefile (the latter of which just
117117
invokes `x.py`). `./configure` is the recommended way to programmatically
118-
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
118+
generate a `bootstrap.toml`. `make` is not recommended (we suggest using `x.py`
119119
directly), but it is supported and we try not to break it unnecessarily.
120120

121121
```sh
122122
./configure
123123
make && sudo make install
124124
```
125125

126-
`configure` generates a `config.toml` which can also be used with normal `x.py`
126+
`configure` generates a `bootstrap.toml` which can also be used with normal `x.py`
127127
invocations.
128128

129129
## Building on Windows
@@ -255,7 +255,7 @@ Windows build triples are:
255255
- `x86_64-pc-windows-msvc`
256256

257257
The build triple can be specified by either specifying `--build=<triple>` when
258-
invoking `x.py` commands, or by creating a `config.toml` file (as described in
258+
invoking `x.py` commands, or by creating a `bootstrap.toml` file (as described in
259259
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
260260
`--set build.build=<triple>` to `./configure`.
261261

‎RELEASES.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ Compatibility Notes
22822282
- [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/)
22832283
- [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/)
22842284
- [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886)
2285-
If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By
2285+
If `tools = [...]` is set in bootstrap.toml, we will respect a missing rustdoc in that list. By
22862286
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
22872287
list.
22882288

@@ -5268,7 +5268,7 @@ related tools.
52685268

52695269
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
52705270
You can continue building with `make` by setting `ninja=false` in
5271-
your `config.toml`.
5271+
your `bootstrap.toml`.
52725272
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
52735273
- [Made `ensure_sufficient_stack()` non-generic][76680]
52745274

‎REUSE.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = [
2222
"Cargo.lock",
2323
"Cargo.toml",
2424
"CODE_OF_CONDUCT.md",
25-
"config.example.toml",
25+
"bootstrap.example.toml",
2626
"configure",
2727
"CONTRIBUTING.md",
2828
"COPYRIGHT",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# All options are commented out by default in this file, and they're commented
77
# out with their default values. The build system by default looks for
8-
# `config.toml` in the current directory of a build for build configuration, but
8+
# `bootstrap.toml` in the current directory of a build for build configuration, but
99
# a custom configuration file can also be specified with `--config` to the build
1010
# system.
1111

@@ -16,7 +16,7 @@
1616
# Use different pre-set defaults than the global defaults.
1717
#
1818
# See `src/bootstrap/defaults` for more information.
19-
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
19+
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
2020
#profile = <none>
2121

2222
# Keeps track of major changes made to this configuration.
@@ -346,7 +346,7 @@
346346
# Enable a build of the extended Rust tool set which is not only the compiler
347347
# but also tools such as Cargo. This will also produce "combined installers"
348348
# which are used to install Rust and Cargo together.
349-
# The `tools` (check `config.example.toml` to see its default value) option specifies
349+
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
350350
# which tools should be built if `extended = true`.
351351
#
352352
# This is disabled by default.

‎compiler/rustc_session/src/options.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ top_level_options!(
389389
///
390390
/// This directory is what the virtual `/rustc/$hash` is translated back to,
391391
/// if Rust was built with path remapping to `/rustc/$hash` enabled
392-
/// (the `rust.remap-debuginfo` option in `config.toml`).
392+
/// (the `rust.remap-debuginfo` option in `bootstrap.toml`).
393393
real_rust_source_base_dir: Option<PathBuf> [TRACKED_NO_CRATE_HASH],
394394

395395
edition: Edition [TRACKED],

‎src/bootstrap/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust.
163163

164164
Because there are two separate codebases behind `x.py`, they need to
165165
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
166-
parse `config.toml` and read the same command line arguments. `bootstrap.py`
166+
parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py`
167167
keeps these in sync by setting various environment variables, and the
168168
programs sometimes have to add arguments that are explicitly ignored, to be
169169
read by the other.

‎src/bootstrap/bootstrap.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def download_toolchain(self):
726726

727727
def should_fix_bins_and_dylibs(self):
728728
"""Whether or not `fix_bin_or_dylib` needs to be run; can only be True
729-
on NixOS or if config.toml has `build.patch-binaries-for-nix` set.
729+
on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set.
730730
"""
731731
if self._should_fix_bins_and_dylibs is not None:
732732
return self._should_fix_bins_and_dylibs
@@ -775,7 +775,7 @@ def get_answer():
775775
"The IN_NIX_SHELL environment variable is `{}`;".format(
776776
in_nix_shell
777777
),
778-
"you may need to set `patch-binaries-for-nix=true` in config.toml",
778+
"you may need to set `patch-binaries-for-nix=true` in bootstrap.toml",
779779
)
780780

781781
return is_nixos
@@ -884,7 +884,7 @@ def bin_root(self):
884884
return os.path.join(self.build_dir, self.build, subdir)
885885

886886
def get_toml(self, key, section=None):
887-
"""Returns the value of the given key in config.toml, otherwise returns None
887+
"""Returns the value of the given key in bootstrap.toml, otherwise returns None
888888
889889
>>> rb = RustBuild()
890890
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
@@ -1250,17 +1250,23 @@ def bootstrap(args):
12501250
"unless you put them in place manually."
12511251
)
12521252

1253-
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`,
1254-
# then `config.toml` in the root directory.
1253+
# Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`.
1254+
# If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory.
1255+
# If those are unavailable, fall back to `./config.toml`, then `config.toml` for
1256+
# backward compatibility.
12551257
toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG")
12561258
using_default_path = toml_path is None
12571259
if using_default_path:
1258-
toml_path = "config.toml"
1260+
toml_path = "bootstrap.toml"
12591261
if not os.path.exists(toml_path):
1260-
toml_path = os.path.join(rust_root, toml_path)
1262+
toml_path = os.path.join(rust_root, "bootstrap.toml")
1263+
if not os.path.exists(toml_path):
1264+
toml_path = "config.toml"
1265+
if not os.path.exists(toml_path):
1266+
toml_path = os.path.join(rust_root, "config.toml")
12611267

12621268
# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
1263-
# but not if `config.toml` hasn't been created.
1269+
# but not if `bootstrap.toml` hasn't been created.
12641270
if not using_default_path or os.path.exists(toml_path):
12651271
with open(toml_path) as config:
12661272
config_toml = config.read()
@@ -1278,7 +1284,9 @@ def bootstrap(args):
12781284
# profiles to be renamed while maintaining back compatibility
12791285
# Keep in sync with `profile_aliases` in config.rs
12801286
profile_aliases = {"user": "dist"}
1281-
include_file = "config.{}.toml".format(profile_aliases.get(profile) or profile)
1287+
include_file = "bootstrap.{}.toml".format(
1288+
profile_aliases.get(profile) or profile
1289+
)
12821290
include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults")
12831291
include_path = os.path.join(include_dir, include_file)
12841292

0 commit comments

Comments
 (0)