File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -518,17 +518,21 @@ impl TargetSelection {
518518
519519impl fmt:: Display for TargetSelection {
520520 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
521- write ! ( f, "{}" , self . triple) ?;
522521 if let Some ( file) = self . file {
523- write ! ( f, "({file})" ) ?;
522+ write ! ( f, "{file}" )
523+ } else {
524+ write ! ( f, "{}" , self . triple)
524525 }
525- Ok ( ( ) )
526526 }
527527}
528528
529529impl fmt:: Debug for TargetSelection {
530530 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
531- write ! ( f, "{self}" )
531+ write ! ( f, "{}" , self . triple) ?;
532+ if let Some ( file) = self . file {
533+ write ! ( f, "({file})" ) ?;
534+ }
535+ Ok ( ( ) )
532536 }
533537}
534538
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::collections::HashMap;
1212use std:: env;
1313use std:: ffi:: { OsStr , OsString } ;
1414use std:: fs;
15- use std:: path:: PathBuf ;
15+ use std:: path:: { Path , PathBuf } ;
1616
1717#[ cfg( not( feature = "bootstrap-self-test" ) ) ]
1818use crate :: builder:: Builder ;
@@ -262,7 +262,9 @@ than building it.
262262
263263 if !has_target {
264264 // This might also be a custom target, so check the target file that could have been specified by the user.
265- if let Some ( custom_target_path) = env:: var_os ( "RUST_TARGET_PATH" ) {
265+ if Path :: new ( & target_str) . exists ( ) {
266+ has_target = true ;
267+ } else if let Some ( custom_target_path) = env:: var_os ( "RUST_TARGET_PATH" ) {
266268 let mut target_filename = OsString :: from ( & target_str) ;
267269 // Target filename ends with `.json`.
268270 target_filename. push ( ".json" ) ;
@@ -277,8 +279,12 @@ than building it.
277279
278280 if !has_target {
279281 panic ! (
280- "No such target exists in the target list,
281- specify a correct location of the JSON specification file for custom targets!"
282+ "No such target exists in the target list,\n \
283+ make sure to correctly specify the location \
284+ of the JSON specification file \
285+ for custom targets!\n \
286+ Use BOOTSTRAP_SKIP_TARGET_SANITY=1 to \
287+ bypass this check."
282288 ) ;
283289 }
284290 }
You can’t perform that action at this time.
0 commit comments