@@ -1157,126 +1157,111 @@ impl Config {
11571157 config. channel = channel;
11581158 }
11591159
1160- let mut llvm_tests = None ;
1161- let mut llvm_enzyme = None ;
1162- let mut llvm_offload = None ;
1163- let mut llvm_plugins = None ;
1164-
1165- if let Some ( llvm) = toml. llvm {
1166- let Llvm {
1167- optimize : optimize_toml,
1168- thin_lto,
1169- release_debuginfo,
1170- assertions : _,
1171- tests,
1172- enzyme,
1173- plugins,
1174- static_libstdcpp,
1175- libzstd,
1176- ninja,
1177- targets,
1178- experimental_targets,
1179- link_jobs,
1180- link_shared,
1181- version_suffix,
1182- clang_cl,
1183- cflags,
1184- cxxflags,
1185- ldflags,
1186- use_libcxx,
1187- use_linker,
1188- allow_old_toolchain,
1189- offload,
1190- polly,
1191- clang,
1192- enable_warnings,
1193- download_ci_llvm,
1194- build_config,
1195- } = llvm;
1196-
1197- set ( & mut config. ninja_in_file , ninja) ;
1198- llvm_tests = tests;
1199- llvm_enzyme = enzyme;
1200- llvm_offload = offload;
1201- llvm_plugins = plugins;
1202- set ( & mut config. llvm_optimize , optimize_toml) ;
1203- set ( & mut config. llvm_thin_lto , thin_lto) ;
1204- set ( & mut config. llvm_release_debuginfo , release_debuginfo) ;
1205- set ( & mut config. llvm_static_stdcpp , static_libstdcpp) ;
1206- set ( & mut config. llvm_libzstd , libzstd) ;
1207- if let Some ( v) = link_shared {
1208- config. llvm_link_shared . set ( Some ( v) ) ;
1209- }
1210- config. llvm_targets . clone_from ( & targets) ;
1211- config. llvm_experimental_targets . clone_from ( & experimental_targets) ;
1212- config. llvm_link_jobs = link_jobs;
1213- config. llvm_version_suffix . clone_from ( & version_suffix) ;
1214- config. llvm_clang_cl . clone_from ( & clang_cl) ;
1215-
1216- config. llvm_cflags . clone_from ( & cflags) ;
1217- config. llvm_cxxflags . clone_from ( & cxxflags) ;
1218- config. llvm_ldflags . clone_from ( & ldflags) ;
1219- set ( & mut config. llvm_use_libcxx , use_libcxx) ;
1220- config. llvm_use_linker . clone_from ( & use_linker) ;
1221- config. llvm_allow_old_toolchain = allow_old_toolchain. unwrap_or ( false ) ;
1222- config. llvm_offload = offload. unwrap_or ( false ) ;
1223- config. llvm_polly = polly. unwrap_or ( false ) ;
1224- config. llvm_clang = clang. unwrap_or ( false ) ;
1225- config. llvm_enable_warnings = enable_warnings. unwrap_or ( false ) ;
1226- config. llvm_build_config = build_config. clone ( ) . unwrap_or ( Default :: default ( ) ) ;
1227-
1228- config. llvm_from_ci =
1229- config. parse_download_ci_llvm ( download_ci_llvm, config. llvm_assertions ) ;
1230-
1231- if config. llvm_from_ci {
1232- let warn = |option : & str | {
1233- println ! (
1234- "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build."
1235- ) ;
1236- println ! (
1237- "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false."
1238- ) ;
1239- } ;
1160+ let Llvm {
1161+ optimize : optimize_toml,
1162+ thin_lto,
1163+ release_debuginfo,
1164+ assertions : _,
1165+ tests : llvm_tests,
1166+ enzyme : llvm_enzyme,
1167+ plugins : llvm_plugin,
1168+ static_libstdcpp,
1169+ libzstd,
1170+ ninja,
1171+ targets,
1172+ experimental_targets,
1173+ link_jobs,
1174+ link_shared,
1175+ version_suffix,
1176+ clang_cl,
1177+ cflags,
1178+ cxxflags,
1179+ ldflags,
1180+ use_libcxx,
1181+ use_linker,
1182+ allow_old_toolchain,
1183+ offload : llvm_offload,
1184+ polly,
1185+ clang,
1186+ enable_warnings,
1187+ download_ci_llvm,
1188+ build_config,
1189+ } = toml. llvm . unwrap_or_default ( ) ;
1190+
1191+ set ( & mut config. ninja_in_file , ninja) ;
1192+ set ( & mut config. llvm_optimize , optimize_toml) ;
1193+ set ( & mut config. llvm_thin_lto , thin_lto) ;
1194+ set ( & mut config. llvm_release_debuginfo , release_debuginfo) ;
1195+ set ( & mut config. llvm_static_stdcpp , static_libstdcpp) ;
1196+ set ( & mut config. llvm_libzstd , libzstd) ;
1197+ if let Some ( v) = link_shared {
1198+ config. llvm_link_shared . set ( Some ( v) ) ;
1199+ }
1200+ config. llvm_targets . clone_from ( & targets) ;
1201+ config. llvm_experimental_targets . clone_from ( & experimental_targets) ;
1202+ config. llvm_link_jobs = link_jobs;
1203+ config. llvm_version_suffix . clone_from ( & version_suffix) ;
1204+ config. llvm_clang_cl . clone_from ( & clang_cl) ;
1205+ config. llvm_tests = llvm_tests. unwrap_or_default ( ) ;
1206+ config. llvm_enzyme = llvm_enzyme. unwrap_or_default ( ) ;
1207+ config. llvm_plugins = llvm_plugin. unwrap_or_default ( ) ;
1208+
1209+ config. llvm_cflags . clone_from ( & cflags) ;
1210+ config. llvm_cxxflags . clone_from ( & cxxflags) ;
1211+ config. llvm_ldflags . clone_from ( & ldflags) ;
1212+ set ( & mut config. llvm_use_libcxx , use_libcxx) ;
1213+ config. llvm_use_linker . clone_from ( & use_linker) ;
1214+ config. llvm_allow_old_toolchain = allow_old_toolchain. unwrap_or ( false ) ;
1215+ config. llvm_offload = llvm_offload. unwrap_or ( false ) ;
1216+ config. llvm_polly = polly. unwrap_or ( false ) ;
1217+ config. llvm_clang = clang. unwrap_or ( false ) ;
1218+ config. llvm_enable_warnings = enable_warnings. unwrap_or ( false ) ;
1219+ config. llvm_build_config = build_config. clone ( ) . unwrap_or ( Default :: default ( ) ) ;
12401220
1241- if static_libstdcpp. is_some ( ) {
1242- warn ( "static-libstdcpp" ) ;
1243- }
1221+ config. llvm_from_ci =
1222+ config. parse_download_ci_llvm ( download_ci_llvm, config. llvm_assertions ) ;
12441223
1245- if link_shared. is_some ( ) {
1246- warn ( "link-shared" ) ;
1247- }
1224+ if config. llvm_from_ci {
1225+ let warn = |option : & str | {
1226+ println ! (
1227+ "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build."
1228+ ) ;
1229+ println ! (
1230+ "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false."
1231+ ) ;
1232+ } ;
12481233
1249- // FIXME(#129153): instead of all the ad-hoc `download-ci-llvm` checks that follow,
1250- // use the `builder-config` present in tarballs since #128822 to compare the local
1251- // config to the ones used to build the LLVM artifacts on CI, and only notify users
1252- // if they've chosen a different value.
1234+ if static_libstdcpp. is_some ( ) {
1235+ warn ( "static-libstdcpp" ) ;
1236+ }
12531237
1254- if libzstd. is_some ( ) {
1255- println ! (
1256- "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \
1257- like almost all `llvm.*` options, will be ignored and set by the LLVM CI \
1258- artifacts builder config."
1259- ) ;
1260- println ! (
1261- "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false."
1262- ) ;
1263- }
1238+ if link_shared. is_some ( ) {
1239+ warn ( "link-shared" ) ;
12641240 }
12651241
1266- if !config. llvm_from_ci && config. llvm_thin_lto && link_shared. is_none ( ) {
1267- // If we're building with ThinLTO on, by default we want to link
1268- // to LLVM shared, to avoid re-doing ThinLTO (which happens in
1269- // the link step) with each stage.
1270- config. llvm_link_shared . set ( Some ( true ) ) ;
1242+ // FIXME(#129153): instead of all the ad-hoc `download-ci-llvm` checks that follow,
1243+ // use the `builder-config` present in tarballs since #128822 to compare the local
1244+ // config to the ones used to build the LLVM artifacts on CI, and only notify users
1245+ // if they've chosen a different value.
1246+
1247+ if libzstd. is_some ( ) {
1248+ println ! (
1249+ "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \
1250+ like almost all `llvm.*` options, will be ignored and set by the LLVM CI \
1251+ artifacts builder config."
1252+ ) ;
1253+ println ! (
1254+ "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false."
1255+ ) ;
12711256 }
1272- } else {
1273- config. llvm_from_ci = config. parse_download_ci_llvm ( None , false ) ;
12741257 }
12751258
1276- config. llvm_tests = llvm_tests. unwrap_or ( false ) ;
1277- config. llvm_enzyme = llvm_enzyme. unwrap_or ( false ) ;
1278- config. llvm_offload = llvm_offload. unwrap_or ( false ) ;
1279- config. llvm_plugins = llvm_plugins. unwrap_or ( false ) ;
1259+ if !config. llvm_from_ci && config. llvm_thin_lto && link_shared. is_none ( ) {
1260+ // If we're building with ThinLTO on, by default we want to link
1261+ // to LLVM shared, to avoid re-doing ThinLTO (which happens in
1262+ // the link step) with each stage.
1263+ config. llvm_link_shared . set ( Some ( true ) ) ;
1264+ }
12801265
12811266 let Gcc { download_ci_gcc : gcc_download_ci_gcc } = toml. gcc . unwrap_or_default ( ) ;
12821267
0 commit comments