Skip to content

Commit ff20e5f

Browse files
committed
change config.toml to bootstrap.toml for bootstrap module
1 parent 2828650 commit ff20e5f

37 files changed

+144
-116
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
@@ -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

+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 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.
@@ -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.

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
@@ -367,8 +367,8 @@ def is_value_list(key):
367367
print("\t\t" + option.desc)
368368
print("")
369369
print("This configure script is a thin configuration shim over the true")
370-
print("configuration system, `config.toml`. You can explore the comments")
371-
print("in `config.example.toml` next to this configure script to see")
370+
print("configuration system, `bootstrap.toml`. You can explore the comments")
371+
print("in `bootstrap.example.toml` next to this configure script to see")
372372
print("more information about what each option is. Additionally you can")
373373
print("pass `--set` as an argument to set arbitrary key/value pairs")
374374
print("in the TOML configuration if desired")
@@ -567,8 +567,8 @@ def apply_args(known_args, option_checking, config):
567567
raise RuntimeError("unhandled option {}".format(option.name))
568568

569569

570-
# "Parse" the `config.example.toml` file into the various sections, and we'll
571-
# use this as a template of a `config.toml` to write out which preserves
570+
# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll
571+
# use this as a template of a `bootstrap.toml` to write out which preserves
572572
# all the various comments and whatnot.
573573
#
574574
# Note that the `target` section is handled separately as we'll duplicate it
@@ -581,7 +581,7 @@ def parse_example_config(known_args, config):
581581
targets = {}
582582
top_level_keys = []
583583

584-
with open(rust_dir + "/config.example.toml") as example_config:
584+
with open(rust_dir + "/bootstrap.example.toml") as example_config:
585585
example_lines = example_config.read().split("\n")
586586
for line in example_lines:
587587
if cur_section is None:
@@ -755,8 +755,8 @@ def quit_if_file_exists(file):
755755

756756

757757
if __name__ == "__main__":
758-
# If 'config.toml' already exists, exit the script at this point
759-
quit_if_file_exists("config.toml")
758+
# If 'bootstrap.toml' already exists, exit the script at this point
759+
quit_if_file_exists("bootstrap.toml")
760760

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

769-
# Now that we've built up our `config.toml`, write it all out in the same
769+
# Now that we've built up our `bootstrap.toml`, write it all out in the same
770770
# order that we read it in.
771771
p("")
772-
p("writing `config.toml` in current directory")
773-
with bootstrap.output("config.toml") as f:
772+
p("writing `bootstrap.toml` in current directory")
773+
with bootstrap.output("bootstrap.toml") as f:
774774
write_config_toml(f, section_order, targets, sections)
775775

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

src/bootstrap/src/bin/main.rs

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

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

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

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

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

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

200202
Some(msg)

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ fn copy_self_contained_objects(
425425
} else if target.contains("-wasi") {
426426
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
427427
panic!(
428-
"Target {:?} does not have a \"wasi-root\" key in Config.toml \
428+
"Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \
429429
or `$WASI_SDK_PATH` set",
430430
target.triple
431431
)
@@ -1294,7 +1294,7 @@ pub fn rustc_cargo_env(
12941294
.env("CFG_VERSION", builder.rust_version());
12951295

12961296
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
1297-
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
1297+
// is enabled in bootstrap.toml, we pass this environment variable to tell build scripts to avoid
12981298
// detecting git information on their own.
12991299
if builder.config.omit_git_hash {
13001300
cargo.env("CFG_OMIT_GIT_HASH", "1");
@@ -1538,7 +1538,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
15381538
{
15391539
run.builder.info(
15401540
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
1541-
HELP: add backend to codegen-backends in config.toml.",
1541+
HELP: add backend to codegen-backends in bootstrap.toml.",
15421542
);
15431543
return true;
15441544
}
@@ -1550,7 +1550,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
15501550
impl Step for CodegenBackend {
15511551
type Output = ();
15521552
const ONLY_HOSTS: bool = true;
1553-
/// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
1553+
/// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built.
15541554
const DEFAULT: bool = true;
15551555

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1000,9 +1000,9 @@ impl Step for PlainSourceTarball {
10001000
let src_files = [
10011001
// tidy-alphabetical-start
10021002
".gitmodules",
1003+
"bootstrap.example.toml",
10031004
"Cargo.lock",
10041005
"Cargo.toml",
1005-
"config.example.toml",
10061006
"configure",
10071007
"CONTRIBUTING.md",
10081008
"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)