Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 361bfce

Browse files
committedApr 7, 2021
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

Lines changed: 67 additions & 69 deletions
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

Lines changed: 1 addition & 0 deletions
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

‎src/bootstrap/config.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct Config {
6767
pub rustc_error_format: Option<String>,
6868
pub json_output: bool,
6969
pub test_compare_mode: bool,
70-
pub llvm_libunwind: Option<LlvmLibunwind>,
70+
pub llvm_libunwind: LlvmLibunwind,
7171
pub color: Color,
7272

7373
pub on_fail: Option<String>,
@@ -101,8 +101,8 @@ pub struct Config {
101101
pub llvm_link_jobs: Option<u32>,
102102
pub llvm_version_suffix: Option<String>,
103103
pub llvm_use_linker: Option<String>,
104-
pub llvm_allow_old_toolchain: Option<bool>,
105-
pub llvm_polly: Option<bool>,
104+
pub llvm_allow_old_toolchain: bool,
105+
pub llvm_polly: bool,
106106
pub llvm_from_ci: bool,
107107

108108
pub use_lld: bool,
@@ -149,7 +149,6 @@ pub struct Config {
149149
// dist misc
150150
pub dist_sign_folder: Option<PathBuf>,
151151
pub dist_upload_addr: Option<String>,
152-
pub dist_gpg_password_file: Option<PathBuf>,
153152
pub dist_compression_formats: Option<Vec<String>>,
154153

155154
// libstd features
@@ -404,10 +403,6 @@ struct Install {
404403
libdir: Option<String>,
405404
mandir: Option<String>,
406405
datadir: Option<String>,
407-
408-
// standard paths, currently unused
409-
infodir: Option<String>,
410-
localstatedir: Option<String>,
411406
}
412407

413408
/// TOML representation of how the LLVM build is configured.
@@ -564,11 +559,10 @@ impl Config {
564559
config.rust_rpath = true;
565560
config.channel = "dev".to_string();
566561
config.codegen_tests = true;
567-
config.ignore_git = false;
568562
config.rust_dist_src = true;
569563
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
570564
config.deny_warnings = true;
571-
config.missing_tools = false;
565+
config.bindir = "bin".into();
572566

573567
// set by build.rs
574568
config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
@@ -598,7 +592,6 @@ impl Config {
598592
config.dry_run = flags.dry_run;
599593
config.keep_stage = flags.keep_stage;
600594
config.keep_stage_std = flags.keep_stage_std;
601-
config.bindir = "bin".into(); // default
602595
config.color = flags.color;
603596
if let Some(value) = flags.deny_warnings {
604597
config.deny_warnings = value;
@@ -748,12 +741,25 @@ impl Config {
748741
config.llvm_ldflags = llvm.ldflags.clone();
749742
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
750743
config.llvm_use_linker = llvm.use_linker.clone();
751-
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain;
752-
config.llvm_polly = llvm.polly;
744+
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
745+
config.llvm_polly = llvm.polly.unwrap_or(false);
753746
config.llvm_from_ci = match llvm.download_ci_llvm {
754747
Some(StringOrBool::String(s)) => {
755748
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
756-
config.build.triple == "x86_64-unknown-linux-gnu"
749+
// This is currently all tier 1 targets (since others may not have CI artifacts)
750+
// https://doc.rust-lang.org/rustc/platform-support.html#tier-1
751+
// FIXME: this is duplicated in bootstrap.py
752+
let supported_platforms = [
753+
"aarch64-unknown-linux-gnu",
754+
"i686-pc-windows-gnu",
755+
"i686-pc-windows-msvc",
756+
"i686-unknown-linux-gnu",
757+
"x86_64-unknown-linux-gnu",
758+
"x86_64-apple-darwin",
759+
"x86_64-pc-windows-gnu",
760+
"x86_64-pc-windows-msvc",
761+
];
762+
supported_platforms.contains(&&*config.build.triple)
757763
}
758764
Some(StringOrBool::Bool(b)) => b,
759765
None => false,
@@ -774,7 +780,6 @@ impl Config {
774780
check_ci_llvm!(llvm.targets);
775781
check_ci_llvm!(llvm.experimental_targets);
776782
check_ci_llvm!(llvm.link_jobs);
777-
check_ci_llvm!(llvm.link_shared);
778783
check_ci_llvm!(llvm.clang_cl);
779784
check_ci_llvm!(llvm.version_suffix);
780785
check_ci_llvm!(llvm.cflags);
@@ -795,6 +800,11 @@ impl Config {
795800
// If we're building with ThinLTO on, we want to link to LLVM
796801
// shared, to avoid re-doing ThinLTO (which happens in the link
797802
// step) with each stage.
803+
assert_ne!(
804+
llvm.link_shared,
805+
Some(false),
806+
"setting link-shared=false is incompatible with thin-lto=true"
807+
);
798808
config.llvm_link_shared = true;
799809
}
800810
}
@@ -820,7 +830,8 @@ impl Config {
820830
set(&mut config.test_compare_mode, rust.test_compare_mode);
821831
config.llvm_libunwind = rust
822832
.llvm_libunwind
823-
.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
833+
.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"))
834+
.unwrap_or_default();
824835
set(&mut config.backtrace, rust.backtrace);
825836
set(&mut config.channel, rust.channel);
826837
config.description = rust.description;
@@ -908,7 +919,6 @@ impl Config {
908919

909920
if let Some(t) = toml.dist {
910921
config.dist_sign_folder = t.sign_folder.map(PathBuf::from);
911-
config.dist_gpg_password_file = t.gpg_password_file.map(PathBuf::from);
912922
config.dist_upload_addr = t.upload_addr;
913923
config.dist_compression_formats = t.compression_formats;
914924
set(&mut config.rust_dist_src, t.src_tarball);
@@ -932,12 +942,8 @@ impl Config {
932942
// default values for all options that we haven't otherwise stored yet.
933943

934944
config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
935-
936-
let default = false;
937-
config.llvm_assertions = llvm_assertions.unwrap_or(default);
938-
939-
let default = true;
940-
config.rust_optimize = optimize.unwrap_or(default);
945+
config.llvm_assertions = llvm_assertions.unwrap_or(false);
946+
config.rust_optimize = optimize.unwrap_or(true);
941947

942948
let default = debug == Some(true);
943949
config.rust_debug_assertions = debug_assertions.unwrap_or(default);

‎src/bootstrap/configure.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,12 @@ def configure_section(lines, config):
439439
lines[i] = "{} = {}".format(key, to_toml(value))
440440
break
441441
if not found:
442-
raise RuntimeError("failed to find config line for {}".format(key))
442+
# These are used by rpm, but aren't accepted by x.py.
443+
# Give a warning that they're ignored, but not a hard error.
444+
if key in ["infodir", "localstatedir"]:
445+
print("warning: {} will be ignored".format(key))
446+
else:
447+
raise RuntimeError("failed to find config line for {}".format(key))
443448

444449

445450
for section_key in config:

‎src/bootstrap/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl Build {
547547
fn std_features(&self, target: TargetSelection) -> String {
548548
let mut features = "panic-unwind".to_string();
549549

550-
match self.config.llvm_libunwind.unwrap_or_default() {
550+
match self.config.llvm_libunwind {
551551
LlvmLibunwind::InTree => features.push_str(" llvm-libunwind"),
552552
LlvmLibunwind::System => features.push_str(" system-llvm-libunwind"),
553553
LlvmLibunwind::No => {}

‎src/bootstrap/native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl Step for Llvm {
256256
enabled_llvm_projects.push("compiler-rt");
257257
}
258258

259-
if let Some(true) = builder.config.llvm_polly {
259+
if builder.config.llvm_polly {
260260
enabled_llvm_projects.push("polly");
261261
}
262262

@@ -311,7 +311,7 @@ impl Step for Llvm {
311311
cfg.define("LLVM_USE_LINKER", linker);
312312
}
313313

314-
if let Some(true) = builder.config.llvm_allow_old_toolchain {
314+
if builder.config.llvm_allow_old_toolchain {
315315
cfg.define("LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN", "YES");
316316
}
317317

0 commit comments

Comments
 (0)
Please sign in to comment.