@@ -9,11 +9,10 @@ use std::fs;
99use std:: io:: { self , ErrorKind } ;
1010use std:: path:: Path ;
1111
12- use crate :: builder:: { Builder , RunConfig , ShouldRun , Step } ;
12+ use crate :: builder:: { crate_description , Builder , RunConfig , ShouldRun , Step } ;
1313use crate :: cache:: Interned ;
14- use crate :: config:: TargetSelection ;
1514use crate :: util:: t;
16- use crate :: { Build , Mode , Subcommand } ;
15+ use crate :: { Build , Compiler , Mode , Subcommand } ;
1716
1817#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
1918pub struct CleanAll { }
@@ -40,7 +39,7 @@ macro_rules! clean_crate_tree {
4039 ( $( $name: ident, $mode: path, $root_crate: literal) ;+ $( ; ) ? ) => { $(
4140 #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
4241 pub struct $name {
43- target : TargetSelection ,
42+ compiler : Compiler ,
4443 crates: Interned <Vec <String >>,
4544 }
4645
@@ -54,22 +53,21 @@ macro_rules! clean_crate_tree {
5453
5554 fn make_run( run: RunConfig <' _>) {
5655 let builder = run. builder;
57- if builder. top_stage != 0 {
58- panic!( "non-stage-0 clean not supported for individual crates" ) ;
59- }
60- builder. ensure( Self { crates: run. cargo_crates_in_set( ) , target: run. target } ) ;
56+ let compiler = builder. compiler( builder. top_stage, run. target) ;
57+ builder. ensure( Self { crates: run. cargo_crates_in_set( ) , compiler } ) ;
6158 }
6259
6360 fn run( self , builder: & Builder <' _>) -> Self :: Output {
64- let compiler = builder. compiler( 0 , self . target) ;
65- let mut cargo = builder. bare_cargo( compiler, $mode, self . target, "clean" ) ;
61+ let compiler = self . compiler;
62+ let target = compiler. host;
63+ let mut cargo = builder. bare_cargo( compiler, $mode, target, "clean" ) ;
6664 for krate in & * self . crates {
6765 cargo. arg( krate) ;
6866 }
6967
7068 builder. info( & format!(
71- "Cleaning stage{} {} artifacts ({} -> {})" ,
72- compiler. stage, stringify!( $name) . to_lowercase( ) , & compiler. host, self . target
69+ "Cleaning stage{} {} artifacts ({} -> {}){} " ,
70+ compiler. stage, stringify!( $name) . to_lowercase( ) , & compiler. host, target , crate_description ( self . crates ) ,
7371 ) ) ;
7472
7573 // NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,
0 commit comments