File tree 3 files changed +26
-4
lines changed
3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -603,7 +603,11 @@ changelog-seen = 2
603
603
604
604
# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
605
605
# as generics will be preserved in symbols (rather than erased into opaque T).
606
- #new-symbol-mangling = false
606
+ # When no setting is given, the new scheme will be used when compiling the
607
+ # compiler and its tools and the legacy scheme will be used when compiling the
608
+ # standard library.
609
+ # If an explicit setting is given, it will be used for all parts of the codebase.
610
+ #new-symbol-mangling = true|false (see comment)
607
611
608
612
# =============================================================================
609
613
# Options for specific targets
Original file line number Diff line number Diff line change @@ -972,8 +972,26 @@ impl<'a> Builder<'a> {
972
972
}
973
973
}
974
974
975
- if self . config . rust_new_symbol_mangling {
975
+ let use_new_symbol_mangling = match self . config . rust_new_symbol_mangling {
976
+ Some ( setting) => {
977
+ // If an explicit setting is given, use that
978
+ setting
979
+ }
980
+ None => {
981
+ if mode == Mode :: Std {
982
+ // The standard library defaults to the legacy scheme
983
+ false
984
+ } else {
985
+ // The compiler and tools default to the new scheme
986
+ true
987
+ }
988
+ }
989
+ } ;
990
+
991
+ if use_new_symbol_mangling {
976
992
rustflags. arg ( "-Zsymbol-mangling-version=v0" ) ;
993
+ } else {
994
+ rustflags. arg ( "-Zsymbol-mangling-version=legacy" ) ;
977
995
}
978
996
979
997
// FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ pub struct Config {
140
140
pub rust_verify_llvm_ir : bool ,
141
141
pub rust_thin_lto_import_instr_limit : Option < u32 > ,
142
142
pub rust_remap_debuginfo : bool ,
143
- pub rust_new_symbol_mangling : bool ,
143
+ pub rust_new_symbol_mangling : Option < bool > ,
144
144
pub rust_profile_use : Option < String > ,
145
145
pub rust_profile_generate : Option < String > ,
146
146
pub llvm_profile_use : Option < String > ,
@@ -870,7 +870,7 @@ impl Config {
870
870
config. rust_run_dsymutil = rust. run_dsymutil . unwrap_or ( false ) ;
871
871
optimize = rust. optimize ;
872
872
ignore_git = rust. ignore_git ;
873
- set ( & mut config. rust_new_symbol_mangling , rust. new_symbol_mangling ) ;
873
+ config. rust_new_symbol_mangling = rust. new_symbol_mangling ;
874
874
set ( & mut config. rust_optimize_tests , rust. optimize_tests ) ;
875
875
set ( & mut config. codegen_tests , rust. codegen_tests ) ;
876
876
set ( & mut config. rust_rpath , rust. rpath ) ;
You can’t perform that action at this time.
0 commit comments