File tree 2 files changed +18
-8
lines changed 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -518,17 +518,21 @@ impl TargetSelection {
518
518
519
519
impl fmt:: Display for TargetSelection {
520
520
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
521
- write ! ( f, "{}" , self . triple) ?;
522
521
if let Some ( file) = self . file {
523
- write ! ( f, "({file})" ) ?;
522
+ write ! ( f, "{file}" )
523
+ } else {
524
+ write ! ( f, "{}" , self . triple)
524
525
}
525
- Ok ( ( ) )
526
526
}
527
527
}
528
528
529
529
impl fmt:: Debug for TargetSelection {
530
530
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 ( ( ) )
532
536
}
533
537
}
534
538
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::collections::HashMap;
12
12
use std:: env;
13
13
use std:: ffi:: { OsStr , OsString } ;
14
14
use std:: fs;
15
- use std:: path:: PathBuf ;
15
+ use std:: path:: { Path , PathBuf } ;
16
16
17
17
#[ cfg( not( feature = "bootstrap-self-test" ) ) ]
18
18
use crate :: builder:: Builder ;
@@ -262,7 +262,9 @@ than building it.
262
262
263
263
if !has_target {
264
264
// 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" ) {
266
268
let mut target_filename = OsString :: from ( & target_str) ;
267
269
// Target filename ends with `.json`.
268
270
target_filename. push ( ".json" ) ;
@@ -277,8 +279,12 @@ than building it.
277
279
278
280
if !has_target {
279
281
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."
282
288
) ;
283
289
}
284
290
}
You can’t perform that action at this time.
0 commit comments