@@ -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 ,
@@ -1109,7 +1108,11 @@ impl Config {
1109
1108
let rustfmt_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
1110
1109
1111
1110
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
+ } ) ;
1113
1116
let vendor = build_vendor. unwrap_or (
1114
1117
rust_info. is_from_tarball ( )
1115
1118
&& src. join ( "vendor" ) . exists ( )
@@ -1672,19 +1675,11 @@ impl Config {
1672
1675
self . target_config . get ( & target) . and_then ( |t| t. rpath ) . unwrap_or ( self . rust_rpath )
1673
1676
}
1674
1677
1675
- pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> bool {
1678
+ pub fn optimized_compiler_builtins ( & self , target : TargetSelection ) -> & CompilerBuiltins {
1676
1679
self . target_config
1677
1680
. get ( & target)
1678
1681
. 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 )
1688
1683
}
1689
1684
1690
1685
pub fn llvm_enabled ( & self , target : TargetSelection ) -> bool {
0 commit comments