@@ -254,7 +254,6 @@ pub struct Config {
254254 pub rust_debuginfo_level_std : DebuginfoLevel ,
255255 pub rust_debuginfo_level_tools : DebuginfoLevel ,
256256 pub rust_debuginfo_level_tests : DebuginfoLevel ,
257- pub rust_split_debuginfo : SplitDebuginfo ,
258257 pub rust_rpath : bool ,
259258 pub rust_strip : bool ,
260259 pub rust_frame_pointers : bool ,
@@ -570,6 +569,7 @@ pub struct Target {
570569 pub ranlib : Option < PathBuf > ,
571570 pub default_linker : Option < PathBuf > ,
572571 pub linker : Option < PathBuf > ,
572+ pub split_debuginfo : Option < SplitDebuginfo > ,
573573 pub sanitizers : Option < bool > ,
574574 pub profiler : Option < StringOrBool > ,
575575 pub rpath : Option < bool > ,
@@ -1126,6 +1126,7 @@ define_config! {
11261126 ranlib: Option <String > = "ranlib" ,
11271127 default_linker: Option <PathBuf > = "default-linker" ,
11281128 linker: Option <String > = "linker" ,
1129+ split_debuginfo: Option <String > = "split-debuginfo" ,
11291130 llvm_config: Option <String > = "llvm-config" ,
11301131 llvm_has_rust_patches: Option <bool > = "llvm-has-rust-patches" ,
11311132 llvm_filecheck: Option <String > = "llvm-filecheck" ,
@@ -1616,11 +1617,14 @@ impl Config {
16161617 debuginfo_level_tools = debuginfo_level_tools_toml;
16171618 debuginfo_level_tests = debuginfo_level_tests_toml;
16181619
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+
16241628 optimize = optimize_toml;
16251629 omit_git_hash = omit_git_hash_toml;
16261630 config. rust_new_symbol_mangling = new_symbol_mangling;
@@ -1841,10 +1845,11 @@ impl Config {
18411845 if let Some ( ref s) = cfg. llvm_filecheck {
18421846 target. llvm_filecheck = Some ( config. src . join ( s) ) ;
18431847 }
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+ } ) ;
18481853 if let Some ( s) = cfg. no_std {
18491854 target. no_std = s;
18501855 }
@@ -1880,6 +1885,12 @@ impl Config {
18801885 } ) . collect ( ) ) ;
18811886 }
18821887
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+
18831894 config. target_config . insert ( TargetSelection :: from_user ( & triple) , target) ;
18841895 }
18851896 }
@@ -2278,6 +2289,13 @@ impl Config {
22782289 } )
22792290 }
22802291
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+
22812299 pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
22822300 self . submodules . unwrap_or ( rust_info. is_managed_git_subrepository ( ) )
22832301 }
0 commit comments