@@ -15,6 +15,7 @@ use std::fs;
1515use std:: path:: PathBuf ;
1616use std:: process:: Command ;
1717
18+ use crate :: builder:: Kind ;
1819use crate :: core:: config:: Target ;
1920use crate :: utils:: helpers:: output;
2021use crate :: Build ;
@@ -64,6 +65,8 @@ pub fn check(build: &mut Build) {
6465 let mut skip_target_sanity =
6566 env:: var_os ( "BOOTSTRAP_SKIP_TARGET_SANITY" ) . is_some_and ( |s| s == "1" || s == "true" ) ;
6667
68+ skip_target_sanity |= build. config . cmd . kind ( ) == Kind :: Check ;
69+
6770 // Skip target sanity checks when we are doing anything with mir-opt tests or Miri
6871 let skipped_paths = [ OsStr :: new ( "mir-opt" ) , OsStr :: new ( "miri" ) ] ;
6972 skip_target_sanity |= build. config . paths . iter ( ) . any ( |path| {
@@ -169,11 +172,8 @@ than building it.
169172 continue ;
170173 }
171174
172- // Some environments don't want or need these tools, such as when testing Miri.
173- // FIXME: it would be better to refactor this code to split necessary setup from pure sanity
174- // checks, and have a regular flag for skipping the latter. Also see
175- // <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
176- if skip_target_sanity {
175+ // skip check for cross-targets
176+ if skip_target_sanity && target != & build. build {
177177 continue ;
178178 }
179179
@@ -215,11 +215,8 @@ than building it.
215215 panic ! ( "All the *-none-* and nvptx* targets are no-std targets" )
216216 }
217217
218- // Some environments don't want or need these tools, such as when testing Miri.
219- // FIXME: it would be better to refactor this code to split necessary setup from pure sanity
220- // checks, and have a regular flag for skipping the latter. Also see
221- // <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
222- if skip_target_sanity {
218+ // skip check for cross-targets
219+ if skip_target_sanity && target != & build. build {
223220 continue ;
224221 }
225222
0 commit comments