Skip to content

Commit d156259

Browse files
authored
Rollup merge of rust-lang#137081 - Shourya742:2025-02-15-change-config.toml-to-bootstrap.toml, r=onur-ozkan
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: rust-lang#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 76bbb3b + c04bc3c commit d156259

File tree

125 files changed

+558
-522
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

+558
-522
lines changed

.github/ISSUE_TEMPLATE/bootstrap.md

+1-1
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

+2-1
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

+2-1
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

+5-5
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
@@ -251,7 +251,7 @@ Windows build triples are:
251251
- `x86_64-pc-windows-msvc`
252252

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

RELEASES.md

+2-2
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

+1-1
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",

config.example.toml renamed to bootstrap.example.toml

+3-3
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.
@@ -325,7 +325,7 @@
325325
# Enable a build of the extended Rust tool set which is not only the compiler
326326
# but also tools such as Cargo. This will also produce "combined installers"
327327
# which are used to install Rust and Cargo together.
328-
# The `tools` (check `config.example.toml` to see its default value) option specifies
328+
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
329329
# which tools should be built if `extended = true`.
330330
#
331331
# This is disabled by default.

src/bootstrap/README.md

+1-1
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

+17-9
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

src/bootstrap/bootstrap_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_known_args(self):
156156

157157

158158
class GenerateAndParseConfig(unittest.TestCase):
159-
"""Test that we can serialize and deserialize a config.toml file"""
159+
"""Test that we can serialize and deserialize a bootstrap.toml file"""
160160

161161
def test_no_args(self):
162162
build = serialize_and_parse([])
@@ -206,11 +206,11 @@ def build_args(self, configure_args=None, args=None, env=None):
206206
# problem in most cases, but there is a scenario where it would cause
207207
# the test to fail.
208208
#
209-
# When a custom local Cargo is configured in config.toml (with the
209+
# When a custom local Cargo is configured in bootstrap.toml (with the
210210
# build.cargo setting), no Cargo is downloaded to any location known by
211211
# bootstrap, and bootstrap relies on that setting to find it.
212212
#
213-
# In this test though we are not using the config.toml of the caller:
213+
# In this test though we are not using the bootstrap.toml of the caller:
214214
# we are generating a blank one instead. If we don't set build.cargo in
215215
# it, the test will have no way to find Cargo, failing the test.
216216
cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN")

src/bootstrap/configure.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ def is_value_list(key):
362362
print("\t\t" + option.desc)
363363
print("")
364364
print("This configure script is a thin configuration shim over the true")
365-
print("configuration system, `config.toml`. You can explore the comments")
366-
print("in `config.example.toml` next to this configure script to see")
365+
print("configuration system, `bootstrap.toml`. You can explore the comments")
366+
print("in `bootstrap.example.toml` next to this configure script to see")
367367
print("more information about what each option is. Additionally you can")
368368
print("pass `--set` as an argument to set arbitrary key/value pairs")
369369
print("in the TOML configuration if desired")
@@ -562,8 +562,8 @@ def apply_args(known_args, option_checking, config):
562562
raise RuntimeError("unhandled option {}".format(option.name))
563563

564564

565-
# "Parse" the `config.example.toml` file into the various sections, and we'll
566-
# use this as a template of a `config.toml` to write out which preserves
565+
# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll
566+
# use this as a template of a `bootstrap.toml` to write out which preserves
567567
# all the various comments and whatnot.
568568
#
569569
# Note that the `target` section is handled separately as we'll duplicate it
@@ -576,7 +576,7 @@ def parse_example_config(known_args, config):
576576
targets = {}
577577
top_level_keys = []
578578

579-
with open(rust_dir + "/config.example.toml") as example_config:
579+
with open(rust_dir + "/bootstrap.example.toml") as example_config:
580580
example_lines = example_config.read().split("\n")
581581
for line in example_lines:
582582
if cur_section is None:
@@ -750,8 +750,8 @@ def quit_if_file_exists(file):
750750

751751

752752
if __name__ == "__main__":
753-
# If 'config.toml' already exists, exit the script at this point
754-
quit_if_file_exists("config.toml")
753+
# If 'bootstrap.toml' already exists, exit the script at this point
754+
quit_if_file_exists("bootstrap.toml")
755755

756756
if "GITHUB_ACTIONS" in os.environ:
757757
print("::group::Configure the build")
@@ -761,11 +761,11 @@ def quit_if_file_exists(file):
761761
p("")
762762
section_order, sections, targets = parse_args(sys.argv[1:])
763763

764-
# Now that we've built up our `config.toml`, write it all out in the same
764+
# Now that we've built up our `bootstrap.toml`, write it all out in the same
765765
# order that we read it in.
766766
p("")
767-
p("writing `config.toml` in current directory")
768-
with bootstrap.output("config.toml") as f:
767+
p("writing `bootstrap.toml` in current directory")
768+
with bootstrap.output("bootstrap.toml") as f:
769769
write_config_toml(f, section_order, targets, sections)
770770

771771
with bootstrap.output("Makefile") as f:

src/bootstrap/src/bin/main.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ fn main() {
7676
check_version(&config)
7777
};
7878

79-
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
79+
// NOTE: Since `./configure` generates a `bootstrap.toml`, distro maintainers will see the
8080
// changelog warning, not the `x.py setup` message.
8181
let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
8282
if suggest_setup {
83-
println!("WARNING: you have not made a `config.toml`");
83+
println!("WARNING: you have not made a `bootstrap.toml`");
8484
println!(
85-
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
86-
`cp config.example.toml config.toml`"
85+
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
86+
`cp bootstrap.example.toml bootstrap.toml`"
8787
);
8888
} else if let Some(suggestion) = &changelog_suggestion {
8989
println!("{suggestion}");
@@ -97,10 +97,10 @@ fn main() {
9797
Build::new(config).build();
9898

9999
if suggest_setup {
100-
println!("WARNING: you have not made a `config.toml`");
100+
println!("WARNING: you have not made a `bootstrap.toml`");
101101
println!(
102-
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
103-
`cp config.example.toml config.toml`"
102+
"HELP: consider running `./x.py setup` or copying `bootstrap.example.toml` by running \
103+
`cp bootstrap.example.toml bootstrap.toml`"
104104
);
105105
} else if let Some(suggestion) = &changelog_suggestion {
106106
println!("{suggestion}");
@@ -159,7 +159,7 @@ fn check_version(config: &Config) -> Option<String> {
159159
}
160160

161161
// Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist,
162-
// then use the one from the config.toml. This way we never show the same warnings
162+
// then use the one from the bootstrap.toml. This way we never show the same warnings
163163
// more than once.
164164
if let Ok(t) = fs::read_to_string(&warned_id_path) {
165165
let last_warned_id = usize::from_str(&t)
@@ -184,16 +184,18 @@ fn check_version(config: &Config) -> Option<String> {
184184

185185
msg.push_str("NOTE: to silence this warning, ");
186186
msg.push_str(&format!(
187-
"update `config.toml` to use `change-id = {latest_change_id}` instead"
187+
"update `bootstrap.toml` to use `change-id = {latest_change_id}` instead"
188188
));
189189

190190
if io::stdout().is_terminal() && !config.dry_run() {
191191
t!(fs::write(warned_id_path, latest_change_id.to_string()));
192192
}
193193
} else {
194-
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");
194+
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");
195195
msg.push_str("NOTE: to silence this warning, ");
196-
msg.push_str(&format!("add `change-id = {latest_change_id}` at the top of `config.toml`"));
196+
msg.push_str(&format!(
197+
"add `change-id = {latest_change_id}` at the top of `bootstrap.toml`"
198+
));
197199
};
198200

199201
Some(msg)

src/bootstrap/src/core/build_steps/compile.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ fn copy_self_contained_objects(
415415
} else if target.contains("-wasi") {
416416
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
417417
panic!(
418-
"Target {:?} does not have a \"wasi-root\" key in Config.toml \
418+
"Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \
419419
or `$WASI_SDK_PATH` set",
420420
target.triple
421421
)
@@ -1282,7 +1282,7 @@ pub fn rustc_cargo_env(
12821282
.env("CFG_VERSION", builder.rust_version());
12831283

12841284
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
1285-
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
1285+
// is enabled in bootstrap.toml, we pass this environment variable to tell build scripts to avoid
12861286
// detecting git information on their own.
12871287
if builder.config.omit_git_hash {
12881288
cargo.env("CFG_OMIT_GIT_HASH", "1");
@@ -1526,7 +1526,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
15261526
{
15271527
run.builder.info(
15281528
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
1529-
HELP: add backend to codegen-backends in config.toml.",
1529+
HELP: add backend to codegen-backends in bootstrap.toml.",
15301530
);
15311531
return true;
15321532
}
@@ -1538,7 +1538,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
15381538
impl Step for CodegenBackend {
15391539
type Output = ();
15401540
const ONLY_HOSTS: bool = true;
1541-
/// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
1541+
/// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built.
15421542
const DEFAULT: bool = true;
15431543

15441544
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

src/bootstrap/src/core/build_steps/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,9 @@ impl Step for PlainSourceTarball {
990990
let src_files = [
991991
// tidy-alphabetical-start
992992
".gitmodules",
993+
"bootstrap.example.toml",
993994
"Cargo.lock",
994995
"Cargo.toml",
995-
"config.example.toml",
996996
"configure",
997997
"CONTRIBUTING.md",
998998
"COPYRIGHT",

src/bootstrap/src/core/build_steps/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ impl Step for RustcBook {
12181218
cmd.env("RUSTC_BOOTSTRAP", "1");
12191219

12201220
// If the lib directories are in an unusual location (changed in
1221-
// config.toml), then this needs to explicitly update the dylib search
1221+
// bootstrap.toml), then this needs to explicitly update the dylib search
12221222
// path.
12231223
builder.add_rustc_lib_path(self.compiler, &mut cmd);
12241224
let doc_generator_guard = builder.msg(

0 commit comments

Comments
 (0)