@@ -358,6 +358,50 @@ impl Step for OptimizedDist {
358358    } 
359359} 
360360
361+ /// The [rustc-perf](https://github.com/rust-lang/rustc-perf) benchmark suite, which is added 
362+ /// as a submodule at `src/tools/rustc-perf`. 
363+ #[ derive( Debug ,  Clone ,  Hash ,  PartialEq ,  Eq ) ]  
364+ pub  struct  RustcPerf  { 
365+     pub  compiler :  Compiler , 
366+     pub  target :  TargetSelection , 
367+ } 
368+ 
369+ impl  Step  for  RustcPerf  { 
370+     /// Path to the built `collector` binary. 
371+ type  Output  = PathBuf ; 
372+ 
373+     fn  should_run ( run :  ShouldRun < ' _ > )  -> ShouldRun < ' _ >  { 
374+         run. path ( "src/tools/rustc-perf" ) 
375+     } 
376+ 
377+     fn  make_run ( run :  RunConfig < ' _ > )  { 
378+         run. builder . ensure ( RustcPerf  { 
379+             compiler :  run. builder . compiler ( 0 ,  run. builder . config . build ) , 
380+             target :  run. target , 
381+         } ) ; 
382+     } 
383+ 
384+     fn  run ( self ,  builder :  & Builder < ' _ > )  -> PathBuf  { 
385+         // We need to ensure the rustc-perf submodule is initialized. 
386+         builder. update_submodule ( Path :: new ( "src/tools/rustc-perf" ) ) ; 
387+ 
388+         let  target = builder. ensure ( ToolBuild  { 
389+             compiler :  self . compiler , 
390+             target :  self . target , 
391+             tool :  "collector" , 
392+             mode :  Mode :: ToolBootstrap , 
393+             path :  "src/tools/rustc-perf" , 
394+             source_type :  SourceType :: Submodule , 
395+             extra_features :  Vec :: new ( ) , 
396+             allow_features :  "" , 
397+             // Only build the collector package, which is used for benchmarking through 
398+             // a CLI. 
399+             cargo_args :  vec ! [ "-p" . to_string( ) ,  "collector" . to_string( ) ] , 
400+         } ) ; 
401+         target
402+     } 
403+ } 
404+ 
361405#[ derive( Debug ,  Clone ,  Hash ,  PartialEq ,  Eq ,  Ord ,  PartialOrd ) ]  
362406pub  struct  ErrorIndex  { 
363407    pub  compiler :  Compiler , 
0 commit comments