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 @@ -609,7 +609,11 @@ changelog-seen = 2
609
609
610
610
# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
611
611
# as generics will be preserved in symbols (rather than erased into opaque T).
612
- #new-symbol-mangling = false
612
+ # When no setting is given, the new scheme will be used when compiling the
613
+ # compiler and its tools and the legacy scheme will be used when compiling the
614
+ # standard library.
615
+ # If an explicit setting is given, it will be used for all parts of the codebase.
616
+ #new-symbol-mangling = true|false (see comment)
613
617
614
618
# =============================================================================
615
619
# 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 @@ -141,7 +141,7 @@ pub struct Config {
141
141
pub rust_verify_llvm_ir : bool ,
142
142
pub rust_thin_lto_import_instr_limit : Option < u32 > ,
143
143
pub rust_remap_debuginfo : bool ,
144
- pub rust_new_symbol_mangling : bool ,
144
+ pub rust_new_symbol_mangling : Option < bool > ,
145
145
pub rust_profile_use : Option < String > ,
146
146
pub rust_profile_generate : Option < String > ,
147
147
pub llvm_profile_use : Option < String > ,
@@ -874,7 +874,7 @@ impl Config {
874
874
config. rust_run_dsymutil = rust. run_dsymutil . unwrap_or ( false ) ;
875
875
optimize = rust. optimize ;
876
876
ignore_git = rust. ignore_git ;
877
- set ( & mut config. rust_new_symbol_mangling , rust. new_symbol_mangling ) ;
877
+ config. rust_new_symbol_mangling = rust. new_symbol_mangling ;
878
878
set ( & mut config. rust_optimize_tests , rust. optimize_tests ) ;
879
879
set ( & mut config. codegen_tests , rust. codegen_tests ) ;
880
880
set ( & mut config. rust_rpath , rust. rpath ) ;
You can’t perform that action at this time.
0 commit comments