@@ -9,11 +9,10 @@ use std::fs;
9
9
use std:: io:: { self , ErrorKind } ;
10
10
use std:: path:: Path ;
11
11
12
- use crate :: builder:: { Builder , RunConfig , ShouldRun , Step } ;
12
+ use crate :: builder:: { crate_description , Builder , RunConfig , ShouldRun , Step } ;
13
13
use crate :: cache:: Interned ;
14
- use crate :: config:: TargetSelection ;
15
14
use crate :: util:: t;
16
- use crate :: { Build , Mode , Subcommand } ;
15
+ use crate :: { Build , Compiler , Mode , Subcommand } ;
17
16
18
17
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
19
18
pub struct CleanAll { }
@@ -40,7 +39,7 @@ macro_rules! clean_crate_tree {
40
39
( $( $name: ident, $mode: path, $root_crate: literal) ;+ $( ; ) ? ) => { $(
41
40
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
42
41
pub struct $name {
43
- target : TargetSelection ,
42
+ compiler : Compiler ,
44
43
crates: Interned <Vec <String >>,
45
44
}
46
45
@@ -54,22 +53,21 @@ macro_rules! clean_crate_tree {
54
53
55
54
fn make_run( run: RunConfig <' _>) {
56
55
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 } ) ;
61
58
}
62
59
63
60
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" ) ;
66
64
for krate in & * self . crates {
67
65
cargo. arg( krate) ;
68
66
}
69
67
70
68
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 ) ,
73
71
) ) ;
74
72
75
73
// NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,
0 commit comments