skip stage 0 target check if BOOTSTRAP_SKIP_TARGET_SANITY is set

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-08-27 10:47:58 +03:00
parent 3f121b9461
commit 6ba72c0c7e

View File

@ -8,9 +8,7 @@
//! In theory if we get past this phase it's a bug if a build fails, but in //! In theory if we get past this phase it's a bug if a build fails, but in
//! practice that's likely not true! //! practice that's likely not true!
use std::collections::HashMap; use std::collections::{HashMap, HashSet};
#[cfg(not(feature = "bootstrap-self-test"))]
use std::collections::HashSet;
use std::ffi::{OsStr, OsString}; use std::ffi::{OsStr, OsString};
use std::path::PathBuf; use std::path::PathBuf;
use std::{env, fs}; use std::{env, fs};
@ -34,7 +32,6 @@ pub struct Finder {
// it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list. // it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list.
// //
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap). // Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
#[cfg(not(feature = "bootstrap-self-test"))]
const STAGE0_MISSING_TARGETS: &[&str] = &[ const STAGE0_MISSING_TARGETS: &[&str] = &[
// just a dummy comment so the list doesn't get onelined // just a dummy comment so the list doesn't get onelined
]; ];
@ -205,7 +202,6 @@ pub fn check(build: &mut Build) {
.map(|p| cmd_finder.must_have(p)) .map(|p| cmd_finder.must_have(p))
.or_else(|| cmd_finder.maybe_have("reuse")); .or_else(|| cmd_finder.maybe_have("reuse"));
#[cfg(not(feature = "bootstrap-self-test"))]
let stage0_supported_target_list: HashSet<String> = crate::utils::helpers::output( let stage0_supported_target_list: HashSet<String> = crate::utils::helpers::output(
command(&build.config.initial_rustc).args(["--print", "target-list"]).as_command_mut(), command(&build.config.initial_rustc).args(["--print", "target-list"]).as_command_mut(),
) )
@ -234,8 +230,7 @@ pub fn check(build: &mut Build) {
} }
// Ignore fake targets that are only used for unit tests in bootstrap. // Ignore fake targets that are only used for unit tests in bootstrap.
#[cfg(not(feature = "bootstrap-self-test"))] if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity {
{
let mut has_target = false; let mut has_target = false;
let target_str = target.to_string(); let target_str = target.to_string();