File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,30 @@ than building it.
177
177
continue ;
178
178
}
179
179
180
+ // Check if there exists a built-in target in the list of supported targets.
181
+ let mut has_target = false ;
182
+ let target_str = target. to_string ( ) ;
183
+
184
+ let supported_target_list = Command :: new ( & build. config . initial_rustc )
185
+ . args ( [ "--print" , "target-list" ] )
186
+ . output ( )
187
+ . expect ( "Should have been able to fetch the target list." ) ;
188
+
189
+ if let Some ( stdout) = String :: from_utf8 ( supported_target_list. stdout ) . ok ( ) {
190
+ has_target |= stdout. contains ( & target_str) ;
191
+ }
192
+
193
+ // If not, check for a valid file location that may have been specified
194
+ // by the user for the custom target.
195
+ has_target |= env:: var_os ( "RUST_TARGET_PATH" ) . is_some ( ) ;
196
+
197
+ if !has_target && !( target_str == "A" || target_str == "B" || target_str == "C" ) {
198
+ panic ! (
199
+ "No such target exists in the target list,
200
+ specify a correct location of the JSON specification file for custom targets!"
201
+ ) ;
202
+ }
203
+
180
204
if !build. config . dry_run ( ) {
181
205
cmd_finder. must_have ( build. cc ( * target) ) ;
182
206
if let Some ( ar) = build. ar ( * target) {
You can’t perform that action at this time.
0 commit comments