@@ -46,8 +46,8 @@ use crate::core::config::toml::rust::{
46
46
} ;
47
47
use crate :: core:: config:: toml:: target:: Target ;
48
48
use 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,
51
51
} ;
52
52
use crate :: core:: download:: {
53
53
DownloadContext , download_beta_toolchain, is_download_ci_available, maybe_download_rustfmt,
@@ -121,8 +121,7 @@ pub struct Config {
121
121
pub patch_binaries_for_nix : Option < bool > ,
122
122
pub stage0_metadata : build_helper:: stage0_parser:: Stage0 ,
123
123
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 ,
126
125
127
126
pub stdout_is_tty : bool ,
128
127
pub stderr_is_tty : bool ,
@@ -1101,7 +1100,11 @@ impl Config {
1101
1100
let rustfmt_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
1102
1101
1103
1102
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
+ } ) ;
1105
1108
let vendor = build_vendor. unwrap_or (
1106
1109
rust_info. is_from_tarball ( )
1107
1110
&& src. join ( "vendor" ) . exists ( )
@@ -1664,19 +1667,11 @@ impl Config {
1664
1667
self . target_config . get ( & target) . and_then ( |t| t. rpath ) . unwrap_or ( self . rust_rpath )
1665
1668
}
1666
1669
1667
- pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> bool {
1670
+ pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> & CompilerBuiltins {
1668
1671
self . target_config
1669
1672
. get ( & target)
1670
1673
. 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 )
1680
1675
}
1681
1676
1682
1677
pub fn llvm_enabled ( & self , target : TargetSelection ) -> bool {
0 commit comments