@@ -29,7 +29,7 @@ use sysroot::Sysroot;
29
29
#[ derive( Debug , Copy , Clone ) ]
30
30
pub struct Compiler < ' a > {
31
31
pub rustc : & ' a Path ,
32
- pub rustdoc : & ' a Path ,
32
+ pub rustdoc : Option < & ' a Path > ,
33
33
pub cargo : & ' a Path ,
34
34
pub triple : & ' a str ,
35
35
pub is_nightly : bool ,
@@ -39,7 +39,7 @@ impl<'a> Compiler<'a> {
39
39
fn from_sysroot ( sysroot : & ' a Sysroot ) -> Compiler < ' a > {
40
40
Compiler {
41
41
rustc : & sysroot. rustc ,
42
- rustdoc : & sysroot. rustdoc ,
42
+ rustdoc : Some ( & sysroot. rustdoc ) ,
43
43
cargo : & sysroot. cargo ,
44
44
triple : & sysroot. triple ,
45
45
is_nightly : true ,
@@ -239,6 +239,11 @@ fn bench_commit(
239
239
call_home : bool ,
240
240
self_profile : bool ,
241
241
) -> BenchmarkErrors {
242
+ if compiler. rustdoc . is_none ( ) && build_kinds. iter ( ) . any ( |b| * b == BuildKind :: Doc ) {
243
+ eprintln ! ( "Rustdoc build specified but rustdoc path not provided" ) ;
244
+ std:: process:: exit ( 1 ) ;
245
+ }
246
+
242
247
let mut errors_recorded = 0 ;
243
248
eprintln ! ( "Benchmarking {} for triple {}" , cid, compiler. triple) ;
244
249
@@ -332,7 +337,8 @@ fn get_benchmarks(
332
337
) -> anyhow:: Result < Vec < Benchmark > > {
333
338
let mut benchmarks = Vec :: new ( ) ;
334
339
' outer: for entry in fs:: read_dir ( benchmark_dir)
335
- . with_context ( || format ! ( "failed to list benchmark dir {}" , benchmark_dir. display( ) ) ) ? {
340
+ . with_context ( || format ! ( "failed to list benchmark dir {}" , benchmark_dir. display( ) ) ) ?
341
+ {
336
342
let entry = entry?;
337
343
let path = entry. path ( ) ;
338
344
let name = match entry. file_name ( ) . into_string ( ) {
@@ -410,7 +416,7 @@ fn main_result() -> anyhow::Result<i32> {
410
416
( @subcommand bench_local =>
411
417
( about: "benchmark a local rustc" )
412
418
( @arg RUSTC : --rustc +required +takes_value "The path to the local rustc to benchmark" )
413
- ( @arg RUSTDOC : --rustdoc +required + takes_value "The path to the local rustdoc to benchmark" )
419
+ ( @arg RUSTDOC : --rustdoc +takes_value "The path to the local rustdoc to benchmark" )
414
420
( @arg CARGO : --cargo +required +takes_value "The path to the local Cargo to use" )
415
421
( @arg BUILDS : --builds +takes_value
416
422
"One or more (comma-separated) of: 'Check', 'Debug',\n \
@@ -431,6 +437,7 @@ fn main_result() -> anyhow::Result<i32> {
431
437
( about: "profile a local rustc" )
432
438
( @arg output_dir: --( "output" ) +required +takes_value "Output directory" )
433
439
( @arg RUSTC : --rustc +required +takes_value "The path to the local rustc to benchmark" )
440
+ ( @arg RUSTDOC : --rustdoc +takes_value "The path to the local rustdoc to benchmark" )
434
441
( @arg CARGO : --cargo +required +takes_value "The path to the local Cargo to use" )
435
442
( @arg BUILDS : --builds +takes_value
436
443
"One or more (comma-separated) of: 'Check', 'Debug',\n \
@@ -498,14 +505,18 @@ fn main_result() -> anyhow::Result<i32> {
498
505
499
506
( "bench_local" , Some ( sub_m) ) => {
500
507
let rustc = sub_m. value_of ( "RUSTC" ) . unwrap ( ) ;
501
- let rustdoc = sub_m. value_of ( "RUSTDOC" ) . unwrap ( ) ;
508
+ let rustdoc = sub_m. value_of ( "RUSTDOC" ) ;
502
509
let cargo = sub_m. value_of ( "CARGO" ) . unwrap ( ) ;
503
510
let build_kinds = build_kinds_from_arg ( & sub_m. value_of ( "BUILDS" ) ) ?;
504
511
let run_kinds = run_kinds_from_arg ( & sub_m. value_of ( "RUNS" ) ) ?;
505
512
let id = sub_m. value_of ( "ID" ) . unwrap ( ) ;
506
513
507
514
let rustc_path = PathBuf :: from ( rustc) . canonicalize ( ) ?;
508
- let rustdoc_path = PathBuf :: from ( rustdoc) . canonicalize ( ) ?;
515
+ let rustdoc_path = if let Some ( r) = rustdoc {
516
+ Some ( PathBuf :: from ( r) . canonicalize ( ) ?)
517
+ } else {
518
+ None
519
+ } ;
509
520
let cargo_path = PathBuf :: from ( cargo) . canonicalize ( ) ?;
510
521
let conn = rt. block_on ( pool. expect ( "--db passed" ) . connection ( ) ) ;
511
522
bench_commit (
@@ -516,7 +527,7 @@ fn main_result() -> anyhow::Result<i32> {
516
527
& run_kinds,
517
528
Compiler {
518
529
rustc : & rustc_path,
519
- rustdoc : & rustdoc_path,
530
+ rustdoc : rustdoc_path. as_deref ( ) ,
520
531
cargo : & cargo_path,
521
532
triple : "x86_64-unknown-linux-gnu" ,
522
533
is_nightly : true ,
@@ -573,7 +584,7 @@ fn main_result() -> anyhow::Result<i32> {
573
584
& run_kinds,
574
585
Compiler {
575
586
rustc : Path :: new ( rustc. trim ( ) ) ,
576
- rustdoc : Path :: new ( rustdoc. trim ( ) ) ,
587
+ rustdoc : Some ( Path :: new ( rustdoc. trim ( ) ) ) ,
577
588
cargo : Path :: new ( cargo. trim ( ) ) ,
578
589
is_nightly : false ,
579
590
triple : "x86_64-unknown-linux-gnu" ,
@@ -598,7 +609,7 @@ fn main_result() -> anyhow::Result<i32> {
598
609
599
610
( "profile" , Some ( sub_m) ) => {
600
611
let rustc = sub_m. value_of ( "RUSTC" ) . unwrap ( ) ;
601
- let rustdoc = sub_m. value_of ( "RUSTDOC" ) . unwrap ( ) ;
612
+ let rustdoc = sub_m. value_of ( "RUSTDOC" ) ;
602
613
let cargo = sub_m. value_of ( "CARGO" ) . unwrap ( ) ;
603
614
let build_kinds = build_kinds_from_arg ( & sub_m. value_of ( "BUILDS" ) ) ?;
604
615
let run_kinds = run_kinds_from_arg ( & sub_m. value_of ( "RUNS" ) ) ?;
@@ -609,11 +620,15 @@ fn main_result() -> anyhow::Result<i32> {
609
620
eprintln ! ( "Profiling with {:?}" , profiler) ;
610
621
611
622
let rustc_path = PathBuf :: from ( rustc) . canonicalize ( ) ?;
612
- let rustdoc_path = PathBuf :: from ( rustdoc) . canonicalize ( ) ?;
623
+ let rustdoc_path = if let Some ( r) = rustdoc {
624
+ Some ( PathBuf :: from ( r) . canonicalize ( ) ?)
625
+ } else {
626
+ None
627
+ } ;
613
628
let cargo_path = PathBuf :: from ( cargo) . canonicalize ( ) ?;
614
629
let compiler = Compiler {
615
630
rustc : & rustc_path,
616
- rustdoc : & rustdoc_path,
631
+ rustdoc : rustdoc_path. as_deref ( ) ,
617
632
cargo : & cargo_path,
618
633
is_nightly : true ,
619
634
triple : "x86_64-unknown-linux-gnu" , // XXX: Technically not necessarily true
0 commit comments