From 6f449f39bf9f61bffede02079334e1dc016ac91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Sat, 7 Dec 2024 11:09:41 +0800 Subject: [PATCH] Default `rust.new-symbol-mangling` to `true` universally Instead of using legacy scheme for library but new scheme for compiler when the option is not set. --- config.example.toml | 8 +++----- src/bootstrap/src/core/builder/cargo.rs | 16 +--------------- src/bootstrap/src/utils/change_tracker.rs | 5 +++++ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/config.example.toml b/config.example.toml index 9ec0d77e79b36..3a2a6f7fdfddf 100644 --- a/config.example.toml +++ b/config.example.toml @@ -757,11 +757,9 @@ # Enable symbol-mangling-version v0. This can be helpful when profiling rustc, # as generics will be preserved in symbols (rather than erased into opaque T). -# When no setting is given, the new scheme will be used when compiling the -# compiler and its tools and the legacy scheme will be used when compiling the -# standard library. -# If an explicit setting is given, it will be used for all parts of the codebase. -#new-symbol-mangling = true|false (see comment) +# When no setting is given, the new scheme will be used when compiling all parts +# of the codebase. +#new-symbol-mangling = true (see comment) # Select LTO mode that will be used for compiling rustc. By default, thin local LTO # (LTO within a single crate) is used (like for any Rust crate). You can also select diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 77f6edaabb248..53fe6abe8278e 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -549,21 +549,7 @@ impl Builder<'_> { rustflags.arg(sysroot_str); } - let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling { - Some(setting) => { - // If an explicit setting is given, use that - setting - } - None => { - if mode == Mode::Std { - // The standard library defaults to the legacy scheme - false - } else { - // The compiler and tools default to the new scheme - true - } - } - }; + let use_new_symbol_mangling = self.config.rust_new_symbol_mangling.unwrap_or(true); // By default, windows-rs depends on a native library that doesn't get copied into the // sysroot. Passing this cfg enables raw-dylib support instead, which makes the native diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 41a541d726940..af320a37aa1fe 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -310,4 +310,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "Revert `rust.download-rustc` global default to `false` and only use `rust.download-rustc = \"if-unchanged\"` default for library and tools profile. As alt CI rustc is built without debug assertions, `rust.debug-assertions = true` will now inhibit downloading CI rustc.", }, + ChangeInfo { + change_id: 133998, + severity: ChangeSeverity::Warning, + summary: "`rust.new-symbol-mangling` now defaults to `true` universally when unset, including when build library.", + }, ];