@@ -42,7 +42,8 @@ fn first<A, B>(v: Vec<(A, B)>) -> Vec<A> {
42
42
v. into_iter ( ) . map ( |( a, _) | a) . collect :: < Vec < _ > > ( )
43
43
}
44
44
45
- fn run_build ( paths : & [ PathBuf ] , config : Config ) -> Cache {
45
+ fn run_build ( paths : & [ PathBuf ] , mut config : Config ) -> Cache {
46
+ config. paths . extend ( paths. to_vec ( ) ) ;
46
47
let kind = config. cmd . kind ( ) ;
47
48
let build = Build :: new ( config) ;
48
49
let builder = Builder :: new ( & build) ;
@@ -58,18 +59,32 @@ fn check_cli<const N: usize>(paths: [&str; N]) {
58
59
}
59
60
60
61
macro_rules! std {
61
- ( $host: ident => $target: ident, stage = $stage: literal) => {
62
- compile:: Std :: new(
63
- Compiler {
64
- host: TargetSelection :: from_user( concat!(
65
- stringify!( $host) ,
66
- "-" ,
67
- stringify!( $host)
68
- ) ) ,
69
- stage: $stage,
70
- } ,
71
- TargetSelection :: from_user( concat!( stringify!( $target) , "-" , stringify!( $target) ) ) ,
72
- )
62
+ ( $host: ident => $target: ident, stage = $stage: literal $( , force_recompile = $force_recompile: literal) ?) => {
63
+ if false $( || $force_recompile) ? {
64
+ compile:: Std :: force_recompile(
65
+ Compiler {
66
+ host: TargetSelection :: from_user( concat!(
67
+ stringify!( $host) ,
68
+ "-" ,
69
+ stringify!( $host)
70
+ ) ) ,
71
+ stage: $stage,
72
+ } ,
73
+ TargetSelection :: from_user( concat!( stringify!( $target) , "-" , stringify!( $target) ) ) ,
74
+ )
75
+ } else {
76
+ compile:: Std :: new(
77
+ Compiler {
78
+ host: TargetSelection :: from_user( concat!(
79
+ stringify!( $host) ,
80
+ "-" ,
81
+ stringify!( $host)
82
+ ) ) ,
83
+ stage: $stage,
84
+ } ,
85
+ TargetSelection :: from_user( concat!( stringify!( $target) , "-" , stringify!( $target) ) ) ,
86
+ )
87
+ }
73
88
} ;
74
89
}
75
90
@@ -203,7 +218,25 @@ fn alias_and_path_for_library() {
203
218
run_build ( & [ "library" . into ( ) , "core" . into ( ) ] , configure ( "build" , & [ "A-A" ] , & [ "A-A" ] ) ) ;
204
219
assert_eq ! (
205
220
first( cache. all:: <compile:: Std >( ) ) ,
206
- & [ std!( A => A , stage = 0 ) , std!( A => A , stage = 1 ) ]
221
+ & [ std!( A => A , stage = 0 ) , std!( A => A , stage = 1 , force_recompile = true ) ]
222
+ ) ;
223
+
224
+ let mut cache =
225
+ run_build ( & [ "library" . into ( ) , "core" . into ( ) ] , configure ( "doc" , & [ "A-A" ] , & [ "A-A" ] ) ) ;
226
+ assert_eq ! ( first( cache. all:: <doc:: Std >( ) ) , & [ doc_std!( A => A , stage = 0 ) ] ) ;
227
+ }
228
+
229
+ #[ test]
230
+ fn std_with_crates_and_force_recompile ( ) {
231
+ let mut cache =
232
+ run_build ( & [ "std" . into ( ) , "alloc" . into ( ) ] , configure ( "build" , & [ "A-A" ] , & [ "A-A" ] ) ) ;
233
+ assert_eq ! (
234
+ first( cache. all:: <compile:: Std >( ) ) ,
235
+ & [
236
+ std!( A => A , stage = 0 ) ,
237
+ std!( A => A , stage = 1 , force_recompile = true )
238
+ . crates( vec![ "alloc" . into( ) , "std" . into( ) ] )
239
+ ]
207
240
) ;
208
241
209
242
let mut cache =
0 commit comments