1
1
use std:: fmt:: { Display , Formatter } ;
2
2
3
3
use crate :: core:: build_steps:: compile:: { Std , Sysroot } ;
4
- use crate :: core:: build_steps:: tool:: RustcPerf ;
4
+ use crate :: core:: build_steps:: tool:: { RustcPerf , Rustdoc } ;
5
5
use crate :: core:: builder:: Builder ;
6
6
use crate :: core:: config:: DebuginfoLevel ;
7
7
use crate :: utils:: exec:: { BootstrapCommand , command} ;
@@ -52,6 +52,18 @@ enum PerfCommand {
52
52
} ,
53
53
}
54
54
55
+ impl PerfCommand {
56
+ fn shared_opts ( & self ) -> Option < & SharedOpts > {
57
+ match self {
58
+ PerfCommand :: Eprintln { opts, .. }
59
+ | PerfCommand :: Samply { opts, .. }
60
+ | PerfCommand :: Cachegrind { opts, .. }
61
+ | PerfCommand :: Benchmark { opts, .. } => Some ( opts) ,
62
+ PerfCommand :: Compare { .. } => None ,
63
+ }
64
+ }
65
+ }
66
+
55
67
#[ derive( Debug , Clone , clap:: Parser ) ]
56
68
struct SharedOpts {
57
69
/// Select the benchmarks that you want to run (separated by commas).
@@ -76,7 +88,7 @@ struct SharedOpts {
76
88
profiles : Vec < Profile > ,
77
89
}
78
90
79
- #[ derive( Clone , Copy , Debug , clap:: ValueEnum ) ]
91
+ #[ derive( Clone , Copy , Debug , PartialEq , clap:: ValueEnum ) ]
80
92
#[ value( rename_all = "PascalCase" ) ]
81
93
pub enum Profile {
82
94
Check ,
@@ -140,6 +152,13 @@ Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
140
152
141
153
let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
142
154
builder. ensure ( Std :: new ( compiler, builder. config . build ) ) ;
155
+
156
+ if let Some ( opts) = args. cmd . shared_opts ( ) {
157
+ if opts. profiles . contains ( & Profile :: Doc ) {
158
+ builder. ensure ( Rustdoc { compiler } ) ;
159
+ }
160
+ }
161
+
143
162
let sysroot = builder. ensure ( Sysroot :: new ( compiler) ) ;
144
163
let rustc = sysroot. join ( "bin/rustc" ) ;
145
164
0 commit comments