8
8
//! In theory if we get past this phase it's a bug if a build fails, but in
9
9
//! practice that's likely not true!
10
10
11
- use std:: collections:: HashMap ;
11
+ use std:: collections:: { HashMap , HashSet } ;
12
12
use std:: env;
13
13
use std:: ffi:: { OsStr , OsString } ;
14
14
use std:: fs;
@@ -33,8 +33,6 @@ pub struct Finder {
33
33
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
34
34
const STAGE0_MISSING_TARGETS : & [ & str ] = & [
35
35
// just a dummy comment so the list doesn't get onelined
36
- "aarch64-apple-visionos" ,
37
- "aarch64-apple-visionos-sim" ,
38
36
] ;
39
37
40
38
impl Finder {
@@ -195,8 +193,22 @@ than building it.
195
193
if ![ "A" , "B" , "C" ] . contains ( & target_str. as_str ( ) ) {
196
194
let mut has_target = false ;
197
195
198
- let supported_target_list =
199
- output ( Command :: new ( & build. config . initial_rustc ) . args ( [ "--print" , "target-list" ] ) ) ;
196
+ let supported_target_list: HashSet < String > =
197
+ output ( Command :: new ( & build. config . initial_rustc ) . args ( [ "--print" , "target-list" ] ) )
198
+ . lines ( )
199
+ . map ( |s| s. to_string ( ) )
200
+ . collect ( ) ;
201
+
202
+ let missing_targets_hashset: HashSet < _ > = STAGE0_MISSING_TARGETS . iter ( ) . map ( |t| t. to_string ( ) ) . collect ( ) ;
203
+ let duplicated_targets: Vec < _ > = supported_target_list. intersection ( & missing_targets_hashset) . collect ( ) ;
204
+
205
+ if !duplicated_targets. is_empty ( ) {
206
+ println ! ( "Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list." ) ;
207
+ for duplicated_target in duplicated_targets {
208
+ println ! ( " {duplicated_target}" ) ;
209
+ }
210
+ std:: process:: exit ( 1 ) ;
211
+ }
200
212
201
213
// Check if it's a built-in target.
202
214
has_target |= supported_target_list. contains ( & target_str) ;
0 commit comments