Skip to content

Commit 361bfce

Browse files
committed
Auto merge of #82451 - jyn514:defaults, r=Mark-Simulacrum
Cleanup option parsing and config.toml.example - Add an assertion that `link-shared = true` when `thin-lto = true`. Previously, link-shared would be silently overwritten. - Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults immediately instead of delaying until later in bootstrap. This makes it easier to find what the default value is. - Remove redundant `config.x = false` when the default was already false - Set defaults for `bindir` in `default_opts()` instead of `parse()` - Update `download-ci-llvm = if-supported` option to match bootstrap.py - Remove redundant check for link_shared. Previously, it was checked twice. - Update various options in config.toml.example to their defaults. Previously, some options showed an example value instead of the default value. - Fix incorrect defaults in config.toml.example + `use-libcxx` defaults to false + Add missing `check-stage = 0` + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`) - Remove redundant defaults in prose - Use the same comment for the default and target-dependent `musl-root` - Fix typos - Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated. - Update more defaults to better reflect how they actually get set - Remove ignored `gpg-password-file` option This stopped being used in 7704d35, but was never removed from config.toml. - Remove unused flags from `config.toml` + Disallow `infodir` and `localstatedir` in `config.toml` + Allow the flags in `./configure`, but give a warning that they will be ignored. + Fix incorrect comment that `datadir` will be ignored. Example output: ``` $ ./configure --set install.infodir=xxx configure: processing command line configure: configure: install.infodir := xxx configure: build.configure-args := ['--set', 'install.infodir=xxx'] warning: infodir will be ignored configure: configure: writing `config.toml` in current directory configure: configure: run `python /home/joshua/rustc3/x.py --help` configure: ``` - Update CHANGELOG cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/bootstrap.20defaults
2 parents ef2ef92 + 28e83a4 commit 361bfce

File tree

6 files changed

+106
-96
lines changed

6 files changed

+106
-96
lines changed

config.toml.example

+67-69
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ changelog-seen = 2
112112

113113
# When invoking `llvm-config` this configures whether the `--shared` argument is
114114
# passed to prefer linking to shared libraries.
115+
# NOTE: `thin-lto = true` requires this to be `true` and will give an error otherwise.
115116
#link-shared = false
116117

117118
# When building llvm, this configures what is being appended to the version.
@@ -120,22 +121,23 @@ changelog-seen = 2
120121
#version-suffix = "-rust-dev"
121122

122123
# On MSVC you can compile LLVM with clang-cl, but the test suite doesn't pass
123-
# with clang-cl, so this is special in that it only compiles LLVM with clang-cl
124-
#clang-cl = '/path/to/clang-cl.exe'
124+
# with clang-cl, so this is special in that it only compiles LLVM with clang-cl.
125+
# Note that this takes a /path/to/clang-cl, not a boolean.
126+
#clang-cl = cc
125127

126128
# Pass extra compiler and linker flags to the LLVM CMake build.
127-
#cflags = "-fextra-flag"
128-
#cxxflags = "-fextra-flag"
129-
#ldflags = "-Wl,extra-flag"
129+
#cflags = ""
130+
#cxxflags = ""
131+
#ldflags = ""
130132

131133
# Use libc++ when building LLVM instead of libstdc++. This is the default on
132134
# platforms already use libc++ as the default C++ library, but this option
133135
# allows you to use libc++ even on platforms when it's not. You need to ensure
134136
# that your host compiler ships with libc++.
135-
#use-libcxx = true
137+
#use-libcxx = false
136138

137139
# The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake.
138-
#use-linker = "lld"
140+
#use-linker = <none> (path)
139141

140142
# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES`
141143
#allow-old-toolchain = false
@@ -147,6 +149,9 @@ changelog-seen = 2
147149
# General build configuration options
148150
# =============================================================================
149151
[build]
152+
# The default stage to use for the `check` subcommand
153+
#check-stage = 0
154+
150155
# The default stage to use for the `doc` subcommand
151156
#doc-stage = 0
152157

@@ -170,38 +175,38 @@ changelog-seen = 2
170175
# binaries of this build triple and the nightly will be used to bootstrap the
171176
# first compiler.
172177
#
173-
# Defaults to host platform
174-
#build = "x86_64-unknown-linux-gnu"
178+
# Defaults to platform where `x.py` is run.
179+
#build = "x86_64-unknown-linux-gnu" (as an example)
175180

176181
# Which triples to produce a compiler toolchain for. Each of these triples will
177182
# be bootstrapped from the build triple themselves.
178183
#
179-
# Defaults to just the build triple
180-
#host = ["x86_64-unknown-linux-gnu"]
184+
# Defaults to just the build triple.
185+
#host = ["x86_64-unknown-linux-gnu"] (as an example)
181186

182187
# Which triples to build libraries (core/alloc/std/test/proc_macro) for. Each of
183188
# these triples will be bootstrapped from the build triple themselves.
184189
#
185190
# Defaults to `host`. If you set this explicitly, you likely want to add all
186191
# host triples to this list as well in order for those host toolchains to be
187192
# able to compile programs for their native target.
188-
#target = ["x86_64-unknown-linux-gnu"]
193+
#target = ["x86_64-unknown-linux-gnu"] (as an example)
189194

190195
# Use this directory to store build artifacts.
191196
# You can use "$ROOT" to indicate the root of the git repository.
192197
#build-dir = "build"
193198

194199
# Instead of downloading the src/stage0.txt version of Cargo specified, use
195200
# this Cargo binary instead to build all Rust code
196-
#cargo = "/path/to/bin/cargo"
201+
#cargo = "/path/to/cargo"
197202

198203
# Instead of downloading the src/stage0.txt version of the compiler
199204
# specified, use this rustc binary instead as the stage0 snapshot compiler.
200-
#rustc = "/path/to/bin/rustc"
205+
#rustc = "/path/to/rustc"
201206

202207
# Instead of download the src/stage0.txt version of rustfmt specified,
203208
# use this rustfmt binary instead as the stage0 snapshot rustfmt.
204-
#rustfmt = "/path/to/bin/rustfmt"
209+
#rustfmt = "/path/to/rustfmt"
205210

206211
# Flag to specify whether any documentation is built. If false, rustdoc and
207212
# friends will still be compiled but they will not be used to generate any
@@ -326,16 +331,9 @@ changelog-seen = 2
326331
# Where to install man pages in `prefix` above
327332
#mandir = "share/man"
328333

329-
# Where to install data in `prefix` above (currently unused)
334+
# Where to install data in `prefix` above
330335
#datadir = "share"
331336

332-
# Where to install additional info in `prefix` above (currently unused)
333-
#infodir = "share/info"
334-
335-
# Where to install local state (currently unused)
336-
# If this is a relative path, it will get installed in `prefix` above
337-
#localstatedir = "/var/lib"
338-
339337
# =============================================================================
340338
# Options for compiling Rust code itself
341339
# =============================================================================
@@ -387,7 +385,9 @@ changelog-seen = 2
387385

388386
# Sets the number of codegen units to build the standard library with,
389387
# regardless of what the codegen-unit setting for the rest of the compiler is.
390-
#codegen-units-std = 1
388+
# NOTE: building with anything other than 1 is known to occasionally have bugs.
389+
# See https://github.com/rust-lang/rust/issues/83600.
390+
#codegen-units-std = codegen-units
391391

392392
# Whether or not debug assertions are enabled for the compiler and standard
393393
# library. Debug assertions control the maximum log level used by rustc. When
@@ -430,19 +430,13 @@ changelog-seen = 2
430430
#debuginfo-level = 0
431431

432432
# Debuginfo level for the compiler.
433-
#
434-
# Defaults to rust.debuginfo-level value
435-
#debuginfo-level-rustc = 0
433+
#debuginfo-level-rustc = debuginfo-level
436434

437435
# Debuginfo level for the standard library.
438-
#
439-
# Defaults to rust.debuginfo-level value
440-
#debuginfo-level-std = 0
436+
#debuginfo-level-std = debuginfo-level
441437

442438
# Debuginfo level for the tools.
443-
#
444-
# Defaults to rust.debuginfo-level value
445-
#debuginfo-level-tools = 0
439+
#debuginfo-level-tools = debuginfo-level
446440

447441
# Debuginfo level for the test suites run with compiletest.
448442
# FIXME(#61117): Some tests fail when this option is enabled.
@@ -469,7 +463,9 @@ changelog-seen = 2
469463
# The default linker that will be hard-coded into the generated compiler for
470464
# targets that don't specify linker explicitly in their target specifications.
471465
# Note that this is not the linker used to link said compiler.
472-
#default-linker = "cc"
466+
#
467+
# See https://doc.rust-lang.org/rustc/codegen-options/index.html#linker for more information.
468+
#default-linker = <none> (path)
473469

474470
# The "channel" for the Rust build to produce. The stable/beta channels only
475471
# allow using stable features, whereas the nightly and dev channels allow using
@@ -479,10 +475,15 @@ changelog-seen = 2
479475
# A descriptive string to be appended to `rustc --version` output, which is
480476
# also used in places like debuginfo `DW_AT_producer`. This may be useful for
481477
# supplementary build information, like distro-specific package versions.
482-
#description = ""
478+
#description = <none> (string)
483479

484-
# The root location of the musl installation directory.
485-
#musl-root = "..."
480+
# The root location of the musl installation directory. The library directory
481+
# will also need to contain libunwind.a for an unwinding implementation. Note
482+
# that this option only makes sense for musl targets that produce statically
483+
# linked binaries.
484+
#
485+
# Defaults to /usr on musl hosts. Has no default otherwise.
486+
#musl-root = <platform specific> (path)
486487

487488
# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
488489
# platforms to ensure that the compiler is usable by default from the build
@@ -505,14 +506,14 @@ changelog-seen = 2
505506
# Having the git information can cause a lot of rebuilds during development.
506507
# Note: If this attribute is not explicitly set (e.g. if left commented out) it
507508
# will default to true if channel = "dev", but will default to false otherwise.
508-
#ignore-git = true
509+
#ignore-git = if channel == "dev" { true } else { false }
509510

510511
# When creating source tarballs whether or not to create a source tarball.
511-
#dist-src = false
512+
#dist-src = true
512513

513514
# After building or testing extended tools (e.g. clippy and rustfmt), append the
514515
# result (broken, compiling, testing) into this JSON file.
515-
#save-toolstates = "/path/to/toolstates.json"
516+
#save-toolstates = <none> (path)
516517

517518
# This is an array of the codegen backends that will be compiled for the rustc
518519
# that's being compiled. The default is to only build the LLVM codegen backend,
@@ -548,9 +549,7 @@ changelog-seen = 2
548549
# Compile the compiler with a non-default ThinLTO import limit. This import
549550
# limit controls the maximum size of functions imported by ThinLTO. Decreasing
550551
# will make code compile faster at the expense of lower runtime performance.
551-
# If `incremental` is set to true above, the import limit will default to 10
552-
# instead of LLVM's default of 100.
553-
#thin-lto-import-instr-limit = 100
552+
#thin-lto-import-instr-limit = if incremental { 10 } else { LLVM default (currently 100) }
554553

555554
# Map debuginfo paths to `/rust/$sha/...`, generally only set for releases
556555
#remap-debuginfo = false
@@ -584,75 +583,78 @@ changelog-seen = 2
584583
# =============================================================================
585584
[target.x86_64-unknown-linux-gnu]
586585

587-
# C compiler to be used to compiler C code. Note that the
586+
# C compiler to be used to compile C code. Note that the
588587
# default value is platform specific, and if not specified it may also depend on
589588
# what platform is crossing to what platform.
590-
#cc = "cc"
589+
# See `src/bootstrap/cc_detect.rs` for details.
590+
#cc = "cc" (path)
591591

592-
# C++ compiler to be used to compiler C++ code (e.g. LLVM and our LLVM shims).
592+
# C++ compiler to be used to compile C++ code (e.g. LLVM and our LLVM shims).
593593
# This is only used for host targets.
594-
#cxx = "c++"
594+
# See `src/bootstrap/cc_detect.rs` for details.
595+
#cxx = "c++" (path)
595596

596597
# Archiver to be used to assemble static libraries compiled from C/C++ code.
597598
# Note: an absolute path should be used, otherwise LLVM build will break.
598-
#ar = "ar"
599+
#ar = "ar" (path)
599600

600601
# Ranlib to be used to assemble static libraries compiled from C/C++ code.
601602
# Note: an absolute path should be used, otherwise LLVM build will break.
602-
#ranlib = "ranlib"
603+
#ranlib = "ranlib" (path)
603604

604-
# Linker to be used to link Rust code. Note that the
605+
# Linker to be used to bootstrap Rust code. Note that the
605606
# default value is platform specific, and if not specified it may also depend on
606607
# what platform is crossing to what platform.
607608
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
608-
#linker = "cc"
609+
#linker = "cc" (path)
609610

610611
# Path to the `llvm-config` binary of the installation of a custom LLVM to link
611612
# against. Note that if this is specified we don't compile LLVM at all for this
612613
# target.
613-
#llvm-config = "../path/to/llvm/root/bin/llvm-config"
614+
#llvm-config = <none> (path)
614615

615616
# Normally the build system can find LLVM's FileCheck utility, but if
616617
# not, you can specify an explicit file name for it.
617-
#llvm-filecheck = "/path/to/FileCheck"
618+
#llvm-filecheck = "/path/to/llvm-version/bin/FileCheck"
618619

619620
# If this target is for Android, this option will be required to specify where
620621
# the NDK for the target lives. This is used to find the C compiler to link and
621622
# build native code.
622-
#android-ndk = "/path/to/ndk"
623+
# See `src/bootstrap/cc_detect.rs` for details.
624+
#android-ndk = <none> (path)
623625

624626
# Build the sanitizer runtimes for this target.
625627
# This option will override the same option under [build] section.
626-
#sanitizers = false
628+
#sanitizers = build.sanitizers (bool)
627629

628630
# Build the profiler runtime for this target(required when compiling with options that depend
629631
# on this runtime, such as `-C profile-generate` or `-Z instrument-coverage`).
630632
# This option will override the same option under [build] section.
631-
#profiler = false
633+
#profiler = build.profiler (bool)
632634

633635
# Force static or dynamic linkage of the standard library for this target. If
634636
# this target is a host for rustc, this will also affect the linkage of the
635637
# compiler itself. This is useful for building rustc on targets that normally
636638
# only use static libraries. If unset, the target's default linkage is used.
637-
#crt-static = false
639+
#crt-static = <platform-specific> (bool)
638640

639641
# The root location of the musl installation directory. The library directory
640642
# will also need to contain libunwind.a for an unwinding implementation. Note
641643
# that this option only makes sense for musl targets that produce statically
642-
# linked binaries
643-
#musl-root = "..."
644+
# linked binaries.
645+
#musl-root = build.musl-root (path)
644646

645647
# The full path to the musl libdir.
646648
#musl-libdir = musl-root/lib
647649

648650
# The root location of the `wasm32-wasi` sysroot. Only used for the
649651
# `wasm32-wasi` target. If you are building wasm32-wasi target, make sure to
650652
# create a `[target.wasm32-wasi]` section and move this field there.
651-
#wasi-root = "..."
653+
#wasi-root = <none> (path)
652654

653655
# Used in testing for configuring where the QEMU images are located, you
654656
# probably don't want to use this.
655-
#qemu-rootfs = "..."
657+
#qemu-rootfs = <none> (path)
656658

657659
# =============================================================================
658660
# Distribution options
@@ -669,31 +671,27 @@ changelog-seen = 2
669671
#
670672
# This folder should be populated ahead of time before the build system is
671673
# invoked.
672-
#sign-folder = "path/to/folder/to/sign"
673-
674-
# This is a file which contains the password of the default gpg key. This will
675-
# be passed to `gpg` down the road when signing all files in `sign-folder`
676-
# above. This should be stored in plaintext.
677-
#gpg-password-file = "path/to/gpg/password"
674+
#sign-folder = <none> (path)
678675

679676
# The remote address that all artifacts will eventually be uploaded to. The
680677
# build system generates manifests which will point to these urls, and for the
681678
# manifests to be correct they'll have to have the right URLs encoded.
682679
#
683680
# Note that this address should not contain a trailing slash as file names will
684681
# be appended to it.
685-
#upload-addr = "https://example.com/folder"
682+
#upload-addr = <none> (URL)
686683

687684
# Whether to build a plain source tarball to upload
688685
# We disable that on Windows not to override the one already uploaded on S3
689686
# as the one built on Windows will contain backslashes in paths causing problems
690687
# on linux
691688
#src-tarball = true
692-
#
693689

694690
# Whether to allow failures when building tools
695691
#missing-tools = false
696692

697693
# List of compression formats to use when generating dist tarballs. The list of
698694
# formats is provided to rust-installer, which must support all of them.
695+
#
696+
# This list must be non-empty.
699697
#compression-formats = ["gz", "xz"]

src/bootstrap/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88
## [Changes since the last major version]
99

1010
- `llvm-libunwind` now accepts `in-tree` (formerly true), `system` or `no` (formerly false) [#77703](https://github.com/rust-lang/rust/pull/77703)
11+
- The options `infodir`, `localstatedir`, and `gpg-password-file` are no longer allowed in config.toml. Previously, they were ignored without warning. Note that `infodir` and `localstatedir` are still accepted by `./configure`, with a warning. [#82451](https://github.com/rust-lang/rust/pull/82451)
1112

1213
### Non-breaking changes
1314

0 commit comments

Comments
 (0)