@@ -241,7 +241,7 @@ fn normalize_args(args: &[String]) -> Vec<String> {
241241 it. collect ( )
242242}
243243
244- #[ derive( Debug , Clone , Default , clap:: Subcommand ) ]
244+ #[ derive( Debug , Clone , clap:: Subcommand ) ]
245245pub enum Subcommand {
246246 #[ command( aliases = [ "b" ] , long_about = "\n
247247 Arguments:
@@ -256,8 +256,11 @@ pub enum Subcommand {
256256 ./x.py build --stage 0
257257 ./x.py build " ) ]
258258 /// Compile either the compiler or libraries
259- #[ default]
260- Build ,
259+ Build {
260+ #[ arg( long) ]
261+ /// Pass `--timings` to Cargo to get crate build timings
262+ timings : bool ,
263+ } ,
261264 #[ command( aliases = [ "c" ] , long_about = "\n
262265 Arguments:
263266 This subcommand accepts a number of paths to directories to the crates
@@ -269,6 +272,9 @@ pub enum Subcommand {
269272 #[ arg( long) ]
270273 /// Check all targets
271274 all_targets : bool ,
275+ #[ arg( long) ]
276+ /// Pass `--timings` to Cargo to get crate build timings
277+ timings : bool ,
272278 } ,
273279 /// Run Clippy (uses rustup/cargo-installed clippy binary)
274280 #[ command( long_about = "\n
@@ -494,11 +500,17 @@ Arguments:
494500 Perf ( PerfArgs ) ,
495501}
496502
503+ impl Default for Subcommand {
504+ fn default ( ) -> Self {
505+ Subcommand :: Build { timings : false }
506+ }
507+ }
508+
497509impl Subcommand {
498510 pub fn kind ( & self ) -> Kind {
499511 match self {
500512 Subcommand :: Bench { .. } => Kind :: Bench ,
501- Subcommand :: Build => Kind :: Build ,
513+ Subcommand :: Build { .. } => Kind :: Build ,
502514 Subcommand :: Check { .. } => Kind :: Check ,
503515 Subcommand :: Clippy { .. } => Kind :: Clippy ,
504516 Subcommand :: Doc { .. } => Kind :: Doc ,
@@ -626,6 +638,13 @@ impl Subcommand {
626638 }
627639 }
628640
641+ pub fn timings ( & self ) -> bool {
642+ match * self {
643+ Subcommand :: Build { timings, .. } | Subcommand :: Check { timings, .. } => timings,
644+ _ => false ,
645+ }
646+ }
647+
629648 pub fn vendor_versioned_dirs ( & self ) -> bool {
630649 match * self {
631650 Subcommand :: Vendor { versioned_dirs, .. } => versioned_dirs,
0 commit comments