diff options
| author | kennytm <kennytm@gmail.com> | 2018-10-12 22:04:01 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-12 22:04:01 +0800 |
| commit | e03db2301e823be6371464228f7d8b10b3189abd (patch) | |
| tree | e9be23e04e12d69aac6e5342dc6f885ad0e7ae12 | |
| parent | 8455468d0d0a253e5c0bbce5410b6976c84dbd02 (diff) | |
| parent | 40e20e288d0f928c25bc74c14d74227c4d5c7182 (diff) | |
| download | rust-e03db2301e823be6371464228f7d8b10b3189abd.tar.gz rust-e03db2301e823be6371464228f7d8b10b3189abd.zip | |
Rollup merge of #54811 - pnkfelix:issue-24840-separate-bootstrap-default-for-optimize-from-debug-setting, r=nikomatsakis
During rustc bootstrap, make default for `optimize` independent of `debug` It may have taken me three and a half years, but I'm following through on my ["threat"](https://github.com/rust-lang/rust/issues/24840#issuecomment-97911700) Fix #24840
| -rw-r--r-- | config.toml.example | 35 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 4 |
2 files changed, 29 insertions, 10 deletions
diff --git a/config.toml.example b/config.toml.example index 312270532af..1c851999130 100644 --- a/config.toml.example +++ b/config.toml.example @@ -243,19 +243,36 @@ # ============================================================================= [rust] -# Indicates that the build should be optimized for debugging Rust. Note that -# this is typically not what you want as it takes an incredibly large amount of -# time to have a debug-mode rustc compile any code (notably libstd). If this -# value is set to `true` it will affect a number of configuration options below -# as well, if unconfigured. -#debug = false - -# Whether or not to optimize the compiler and standard library +# Whether or not to optimize the compiler and standard library. +# # Note: the slowness of the non optimized compiler compiling itself usually # outweighs the time gains in not doing optimizations, therefore a -# full bootstrap takes much more time with optimize set to false. +# full bootstrap takes much more time with `optimize` set to false. #optimize = true +# Indicates that the build should be configured for debugging Rust. A +# `debug`-enabled compiler and standard library will be somewhat +# slower (due to e.g. checking of debug assertions) but should remain +# usable. +# +# Note: If this value is set to `true`, it will affect a number of +# configuration options below as well, if they have been left +# unconfigured in this file. +# +# Note: changes to the `debug` setting do *not* affect `optimize` +# above. In theory, a "maximally debuggable" environment would +# set `optimize` to `false` above to assist the introspection +# facilities of debuggers like lldb and gdb. To recreate such an +# environment, explicitly set `optimize` to `false` and `debug` +# to `true`. In practice, everyone leaves `optimize` set to +# `true`, because an unoptimized rustc with debugging +# enabled becomes *unusably slow* (e.g. rust-lang/rust#24840 +# reported a 25x slowdown) and bootstrapping the supposed +# "maximally debuggable" environment (notably libstd) takes +# hours to build. +# +#debug = false + # Number of codegen units to use for each compiler invocation. A value of 0 # means "the number of cores on this machine", and 1+ is passed through to the # compiler. diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index c3fbc8eeca6..a5ed096a735 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -628,6 +628,9 @@ impl Config { let default = false; config.llvm_assertions = llvm_assertions.unwrap_or(default); + let default = true; + config.rust_optimize = optimize.unwrap_or(default); + let default = match &config.channel[..] { "stable" | "beta" | "nightly" => true, _ => false, @@ -640,7 +643,6 @@ impl Config { config.debug_jemalloc = debug_jemalloc.unwrap_or(default); config.rust_debuginfo = debuginfo.unwrap_or(default); config.rust_debug_assertions = debug_assertions.unwrap_or(default); - config.rust_optimize = optimize.unwrap_or(!default); let default = config.channel == "dev"; config.ignore_git = ignore_git.unwrap_or(default); |
