@@ -46,6 +46,7 @@ pub struct Std {
46
46
/// but we need to use the downloaded copy of std for linking to rustdoc. Allow this to be overriden by `builder.ensure` from other steps.
47
47
force_recompile : bool ,
48
48
extra_rust_args : & ' static [ & ' static str ] ,
49
+ is_for_mir_opt_tests : bool ,
49
50
}
50
51
51
52
impl Std {
@@ -56,6 +57,7 @@ impl Std {
56
57
crates : Default :: default ( ) ,
57
58
force_recompile : false ,
58
59
extra_rust_args : & [ ] ,
60
+ is_for_mir_opt_tests : false ,
59
61
}
60
62
}
61
63
@@ -66,6 +68,18 @@ impl Std {
66
68
crates : Default :: default ( ) ,
67
69
force_recompile : true ,
68
70
extra_rust_args : & [ ] ,
71
+ is_for_mir_opt_tests : false ,
72
+ }
73
+ }
74
+
75
+ pub fn new_for_mir_opt_tests ( compiler : Compiler , target : TargetSelection ) -> Self {
76
+ Self {
77
+ target,
78
+ compiler,
79
+ crates : Default :: default ( ) ,
80
+ force_recompile : false ,
81
+ extra_rust_args : & [ ] ,
82
+ is_for_mir_opt_tests : true ,
69
83
}
70
84
}
71
85
@@ -80,6 +94,7 @@ impl Std {
80
94
crates : Default :: default ( ) ,
81
95
force_recompile : false ,
82
96
extra_rust_args,
97
+ is_for_mir_opt_tests : false ,
83
98
}
84
99
}
85
100
}
@@ -109,6 +124,7 @@ impl Step for Std {
109
124
crates,
110
125
force_recompile : false ,
111
126
extra_rust_args : & [ ] ,
127
+ is_for_mir_opt_tests : false ,
112
128
} ) ;
113
129
}
114
130
@@ -206,11 +222,19 @@ impl Step for Std {
206
222
}
207
223
}
208
224
209
- let mut cargo = builder. cargo ( compiler, Mode :: Std , SourceType :: InTree , target, "build" ) ;
210
- std_cargo ( builder, target, compiler. stage , & mut cargo) ;
211
- for krate in & * self . crates {
212
- cargo. arg ( "-p" ) . arg ( krate) ;
213
- }
225
+ let mut cargo = if self . is_for_mir_opt_tests {
226
+ let mut cargo = builder. cargo ( compiler, Mode :: Std , SourceType :: InTree , target, "rustc" ) ;
227
+ cargo. arg ( "-p" ) . arg ( "std" ) . arg ( "--crate-type=lib" ) ;
228
+ std_cargo ( builder, target, compiler. stage , & mut cargo) ;
229
+ cargo
230
+ } else {
231
+ let mut cargo = builder. cargo ( compiler, Mode :: Std , SourceType :: InTree , target, "build" ) ;
232
+ std_cargo ( builder, target, compiler. stage , & mut cargo) ;
233
+ for krate in & * self . crates {
234
+ cargo. arg ( "-p" ) . arg ( krate) ;
235
+ }
236
+ cargo
237
+ } ;
214
238
215
239
// See src/bootstrap/synthetic_targets.rs
216
240
if target. is_synthetic ( ) {
0 commit comments