@@ -215,6 +215,7 @@ pub(crate) fn run_tests(
215
215
dirs : & Dirs ,
216
216
channel : & str ,
217
217
sysroot_kind : SysrootKind ,
218
+ use_unstable_features : bool ,
218
219
cg_clif_dylib : & Path ,
219
220
bootstrap_host_compiler : & Compiler ,
220
221
rustup_toolchain_name : Option < & str > ,
@@ -234,6 +235,7 @@ pub(crate) fn run_tests(
234
235
let runner = TestRunner :: new (
235
236
dirs. clone ( ) ,
236
237
target_compiler,
238
+ use_unstable_features,
237
239
bootstrap_host_compiler. triple == target_triple,
238
240
) ;
239
241
@@ -263,6 +265,7 @@ pub(crate) fn run_tests(
263
265
let runner = TestRunner :: new (
264
266
dirs. clone ( ) ,
265
267
target_compiler,
268
+ use_unstable_features,
266
269
bootstrap_host_compiler. triple == target_triple,
267
270
) ;
268
271
@@ -283,12 +286,18 @@ pub(crate) fn run_tests(
283
286
struct TestRunner {
284
287
is_native : bool ,
285
288
jit_supported : bool ,
289
+ use_unstable_features : bool ,
286
290
dirs : Dirs ,
287
291
target_compiler : Compiler ,
288
292
}
289
293
290
294
impl TestRunner {
291
- fn new ( dirs : Dirs , mut target_compiler : Compiler , is_native : bool ) -> Self {
295
+ fn new (
296
+ dirs : Dirs ,
297
+ mut target_compiler : Compiler ,
298
+ use_unstable_features : bool ,
299
+ is_native : bool ,
300
+ ) -> Self {
292
301
if let Ok ( rustflags) = env:: var ( "RUSTFLAGS" ) {
293
302
target_compiler. rustflags . push ( ' ' ) ;
294
303
target_compiler. rustflags . push_str ( & rustflags) ;
@@ -303,11 +312,12 @@ impl TestRunner {
303
312
target_compiler. rustflags . push_str ( " -Clink-arg=-undefined -Clink-arg=dynamic_lookup" ) ;
304
313
}
305
314
306
- let jit_supported = is_native
315
+ let jit_supported = use_unstable_features
316
+ && is_native
307
317
&& target_compiler. triple . contains ( "x86_64" )
308
318
&& !target_compiler. triple . contains ( "windows" ) ;
309
319
310
- Self { is_native, jit_supported, dirs, target_compiler }
320
+ Self { is_native, jit_supported, use_unstable_features , dirs, target_compiler }
311
321
}
312
322
313
323
fn run_testsuite ( & self , tests : & [ TestCase ] ) {
@@ -326,10 +336,24 @@ impl TestRunner {
326
336
match * cmd {
327
337
TestCaseCmd :: Custom { func } => func ( self ) ,
328
338
TestCaseCmd :: BuildLib { source, crate_types } => {
329
- self . run_rustc ( [ source, "--crate-type" , crate_types] ) ;
339
+ if self . use_unstable_features {
340
+ self . run_rustc ( [ source, "--crate-type" , crate_types] ) ;
341
+ } else {
342
+ self . run_rustc ( [
343
+ source,
344
+ "--crate-type" ,
345
+ crate_types,
346
+ "--cfg" ,
347
+ "no_unstable_features" ,
348
+ ] ) ;
349
+ }
330
350
}
331
351
TestCaseCmd :: BuildBinAndRun { source, args } => {
332
- self . run_rustc ( [ source] ) ;
352
+ if self . use_unstable_features {
353
+ self . run_rustc ( [ source] ) ;
354
+ } else {
355
+ self . run_rustc ( [ source, "--cfg" , "no_unstable_features" ] ) ;
356
+ }
333
357
self . run_out_command (
334
358
source. split ( '/' ) . last ( ) . unwrap ( ) . split ( '.' ) . next ( ) . unwrap ( ) ,
335
359
args,
0 commit comments