Commit 290951a 1 parent ca7d34e commit 290951a Copy full SHA for 290951a
File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,31 @@ 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 ( "rustc" )
185
+ . current_dir ( build. config . src . clone ( ) )
186
+ . args ( [ "--print" , "target-list" ] )
187
+ . output ( )
188
+ . expect ( "Should have been able to fetch the target list." ) ;
189
+
190
+ if let Some ( stdout) = String :: from_utf8 ( supported_target_list. stdout ) . ok ( ) {
191
+ has_target |= stdout. contains ( & target_str) ;
192
+ }
193
+
194
+ // If not, check for a valid file location that may have been specified
195
+ // by the user for the custom target.
196
+ has_target |= env:: var_os ( "RUST_TARGET_PATH" ) . is_some ( ) ;
197
+
198
+ if !has_target && !( target_str == "A" || target_str == "B" || target_str == "C" ) {
199
+ panic ! (
200
+ "No such target exists in the target list,
201
+ specify a correct location of the JSON specification file for custom targets!"
202
+ ) ;
203
+ }
204
+
180
205
if !build. config . dry_run ( ) {
181
206
cmd_finder. must_have ( build. cc ( * target) ) ;
182
207
if let Some ( ar) = build. ar ( * target) {
You can’t perform that action at this time.
0 commit comments