@@ -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 ,
@@ -1109,7 +1108,11 @@ impl Config {
11091108 let rustfmt_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
11101109
11111110 let optimized_compiler_builtins =
1112- build_optimized_compiler_builtins. unwrap_or ( channel != "dev" ) ;
1111+ build_optimized_compiler_builtins. unwrap_or ( if channel == "dev" {
1112+ CompilerBuiltins :: BuildRustOnly
1113+ } else {
1114+ CompilerBuiltins :: BuildLLVMFuncs
1115+ } ) ;
11131116 let vendor = build_vendor. unwrap_or (
11141117 rust_info. is_from_tarball ( )
11151118 && src. join ( "vendor" ) . exists ( )
@@ -1672,19 +1675,11 @@ impl Config {
16721675 self . target_config . get ( & target) . and_then ( |t| t. rpath ) . unwrap_or ( self . rust_rpath )
16731676 }
16741677
1675- pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> bool {
1678+ pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> & CompilerBuiltins {
16761679 self . target_config
16771680 . get ( & target)
16781681 . and_then ( |t| t. optimized_compiler_builtins . as_ref ( ) )
1679- . map ( StringOrBool :: is_string_or_true)
1680- . unwrap_or ( self . optimized_compiler_builtins )
1681- }
1682-
1683- pub fn optimized_compiler_builtins_path ( & self , target : TargetSelection ) -> Option < & str > {
1684- match self . target_config . get ( & target) ?. optimized_compiler_builtins . as_ref ( ) ? {
1685- StringOrBool :: String ( s) => Some ( s) ,
1686- StringOrBool :: Bool ( _) => None ,
1687- }
1682+ . unwrap_or ( & self . optimized_compiler_builtins )
16881683 }
16891684
16901685 pub fn llvm_enabled ( & self , target : TargetSelection ) -> bool {
0 commit comments