@@ -340,6 +340,44 @@ impl Step for Cargo {
340340 }
341341}
342342
343+ #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
344+ pub struct Clippy {
345+ pub compiler : Compiler ,
346+ pub target : Interned < String > ,
347+ }
348+
349+ impl Step for Clippy {
350+ type Output = PathBuf ;
351+ const DEFAULT : bool = false ;
352+ const ONLY_HOSTS : bool = true ;
353+
354+ fn should_run ( run : ShouldRun ) -> ShouldRun {
355+ run. path ( "src/tools/clippy" )
356+ }
357+
358+ fn make_run ( run : RunConfig ) {
359+ run. builder . ensure ( Clippy {
360+ compiler : run. builder . compiler ( run. builder . top_stage , run. builder . build . build ) ,
361+ target : run. target ,
362+ } ) ;
363+ }
364+
365+ fn run ( self , builder : & Builder ) -> PathBuf {
366+ // Clippy depends on procedural macros (serde), which requires a full host
367+ // compiler to be available, so we need to depend on that.
368+ builder. ensure ( compile:: Rustc {
369+ compiler : self . compiler ,
370+ target : builder. build . build ,
371+ } ) ;
372+ builder. ensure ( ToolBuild {
373+ compiler : self . compiler ,
374+ target : self . target ,
375+ tool : "clippy" ,
376+ mode : Mode :: Librustc ,
377+ } )
378+ }
379+ }
380+
343381#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
344382pub struct Rls {
345383 pub compiler : Compiler ,
0 commit comments