@@ -46,8 +46,8 @@ use crate::core::config::toml::rust::{
4646} ;
4747use crate :: core:: config:: toml:: target:: Target ;
4848use crate :: core:: config:: {
49- DebuginfoLevel , DryRun , GccCiMode , LlvmLibunwind , Merge , ReplaceOpt , RustcLto , SplitDebuginfo ,
50- StringOrBool , threads_from_config,
49+ CompilerBuiltins , DebuginfoLevel , DryRun , GccCiMode , LlvmLibunwind , Merge , ReplaceOpt ,
50+ RustcLto , SplitDebuginfo , StringOrBool , threads_from_config,
5151} ;
5252use crate :: core:: download:: {
5353 DownloadContext , download_beta_toolchain, is_download_ci_available, maybe_download_rustfmt,
@@ -121,8 +121,7 @@ pub struct Config {
121121 pub patch_binaries_for_nix : Option < bool > ,
122122 pub stage0_metadata : build_helper:: stage0_parser:: Stage0 ,
123123 pub android_ndk : Option < PathBuf > ,
124- /// Whether to use the `c` feature of the `compiler_builtins` crate.
125- pub optimized_compiler_builtins : bool ,
124+ pub optimized_compiler_builtins : CompilerBuiltins ,
126125
127126 pub stdout_is_tty : bool ,
128127 pub stderr_is_tty : bool ,
@@ -1101,7 +1100,11 @@ impl Config {
11011100 let rustfmt_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
11021101
11031102 let optimized_compiler_builtins =
1104- build_optimized_compiler_builtins. unwrap_or ( channel != "dev" ) ;
1103+ build_optimized_compiler_builtins. unwrap_or ( if channel == "dev" {
1104+ CompilerBuiltins :: BuildRustOnly
1105+ } else {
1106+ CompilerBuiltins :: BuildLLVMFuncs
1107+ } ) ;
11051108 let vendor = build_vendor. unwrap_or (
11061109 rust_info. is_from_tarball ( )
11071110 && src. join ( "vendor" ) . exists ( )
@@ -1664,19 +1667,11 @@ impl Config {
16641667 self . target_config . get ( & target) . and_then ( |t| t. rpath ) . unwrap_or ( self . rust_rpath )
16651668 }
16661669
1667- pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> bool {
1670+ pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> & CompilerBuiltins {
16681671 self . target_config
16691672 . get ( & target)
16701673 . and_then ( |t| t. optimized_compiler_builtins . as_ref ( ) )
1671- . map ( StringOrBool :: is_string_or_true)
1672- . unwrap_or ( self . optimized_compiler_builtins )
1673- }
1674-
1675- pub fn optimized_compiler_builtins_path ( & self , target : TargetSelection ) -> Option < & str > {
1676- match self . target_config . get ( & target) ?. optimized_compiler_builtins . as_ref ( ) ? {
1677- StringOrBool :: String ( s) => Some ( s) ,
1678- StringOrBool :: Bool ( _) => None ,
1679- }
1674+ . unwrap_or ( & self . optimized_compiler_builtins )
16801675 }
16811676
16821677 pub fn llvm_enabled ( & self , target : TargetSelection ) -> bool {
0 commit comments