@@ -254,7 +254,6 @@ pub struct Config {
254
254
pub rust_debuginfo_level_std : DebuginfoLevel ,
255
255
pub rust_debuginfo_level_tools : DebuginfoLevel ,
256
256
pub rust_debuginfo_level_tests : DebuginfoLevel ,
257
- pub rust_split_debuginfo : SplitDebuginfo ,
258
257
pub rust_rpath : bool ,
259
258
pub rust_strip : bool ,
260
259
pub rust_frame_pointers : bool ,
@@ -570,6 +569,7 @@ pub struct Target {
570
569
pub ranlib : Option < PathBuf > ,
571
570
pub default_linker : Option < PathBuf > ,
572
571
pub linker : Option < PathBuf > ,
572
+ pub split_debuginfo : Option < SplitDebuginfo > ,
573
573
pub sanitizers : Option < bool > ,
574
574
pub profiler : Option < StringOrBool > ,
575
575
pub rpath : Option < bool > ,
@@ -1126,6 +1126,7 @@ define_config! {
1126
1126
ranlib: Option <String > = "ranlib" ,
1127
1127
default_linker: Option <PathBuf > = "default-linker" ,
1128
1128
linker: Option <String > = "linker" ,
1129
+ split_debuginfo: Option <String > = "split-debuginfo" ,
1129
1130
llvm_config: Option <String > = "llvm-config" ,
1130
1131
llvm_has_rust_patches: Option <bool > = "llvm-has-rust-patches" ,
1131
1132
llvm_filecheck: Option <String > = "llvm-filecheck" ,
@@ -1616,11 +1617,14 @@ impl Config {
1616
1617
debuginfo_level_tools = debuginfo_level_tools_toml;
1617
1618
debuginfo_level_tests = debuginfo_level_tests_toml;
1618
1619
1619
- config. rust_split_debuginfo = split_debuginfo
1620
- . as_deref ( )
1621
- . map ( SplitDebuginfo :: from_str)
1622
- . map ( |v| v. expect ( "invalid value for rust.split_debuginfo" ) )
1623
- . unwrap_or ( SplitDebuginfo :: default_for_platform ( config. build ) ) ;
1620
+ // FIXME: Remove this and the `Rust.split_debuginfo` field after people had time to
1621
+ // migrate. (The changelog can only be shown if the config parses successfully, so keep
1622
+ // the field around and provide a useful error message).
1623
+ assert ! (
1624
+ split_debuginfo. is_none( ) ,
1625
+ "`rust.split_debuginfo` is no longer supported, specify `target.<triple>.split_debuginfo` instead."
1626
+ ) ;
1627
+
1624
1628
optimize = optimize_toml;
1625
1629
omit_git_hash = omit_git_hash_toml;
1626
1630
config. rust_new_symbol_mangling = new_symbol_mangling;
@@ -1841,10 +1845,11 @@ impl Config {
1841
1845
if let Some ( ref s) = cfg. llvm_filecheck {
1842
1846
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
1843
1847
}
1844
- target. llvm_libunwind = cfg
1845
- . llvm_libunwind
1846
- . as_ref ( )
1847
- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1848
+ target. llvm_libunwind = cfg. llvm_libunwind . as_ref ( ) . map ( |v| {
1849
+ v. parse ( ) . unwrap_or_else ( |_| {
1850
+ panic ! ( "failed to parse target.{triple}.llvm-libunwind" )
1851
+ } )
1852
+ } ) ;
1848
1853
if let Some ( s) = cfg. no_std {
1849
1854
target. no_std = s;
1850
1855
}
@@ -1880,6 +1885,12 @@ impl Config {
1880
1885
} ) . collect ( ) ) ;
1881
1886
}
1882
1887
1888
+ target. split_debuginfo = cfg. split_debuginfo . as_ref ( ) . map ( |v| {
1889
+ v. parse ( ) . unwrap_or_else ( |_| {
1890
+ panic ! ( "invalid value for target.{triple}.split_debuginfo" )
1891
+ } )
1892
+ } ) ;
1893
+
1883
1894
config. target_config . insert ( TargetSelection :: from_user ( & triple) , target) ;
1884
1895
}
1885
1896
}
@@ -2278,6 +2289,13 @@ impl Config {
2278
2289
} )
2279
2290
}
2280
2291
2292
+ pub fn split_debuginfo ( & self , target : TargetSelection ) -> SplitDebuginfo {
2293
+ self . target_config
2294
+ . get ( & target)
2295
+ . and_then ( |t| t. split_debuginfo )
2296
+ . unwrap_or_else ( || SplitDebuginfo :: default_for_platform ( target) )
2297
+ }
2298
+
2281
2299
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
2282
2300
self . submodules . unwrap_or ( rust_info. is_managed_git_subrepository ( ) )
2283
2301
}
0 commit comments