@@ -225,7 +225,7 @@ pub(crate) fn run(
225
225
} )
226
226
} ) ?;
227
227
228
- tests. run_tests ( test_args, nocapture, opts) ;
228
+ tests. run_tests ( test_args, nocapture, opts, & unused_extern_reports ) ;
229
229
230
230
// Collect and warn about unused externs, but only if we've gotten
231
231
// reports for each doctest
@@ -1256,7 +1256,7 @@ impl DocTestKinds {
1256
1256
opts : & GlobalTestOptions ,
1257
1257
edition : Edition ,
1258
1258
path : PathBuf ,
1259
- unused_externs : Arc < Mutex < Vec < UnusedExterns > > > ,
1259
+ unused_externs : & Arc < Mutex < Vec < UnusedExterns > > > ,
1260
1260
) {
1261
1261
if doctest. failed_ast
1262
1262
|| doctest. lang_string . compile_fail
@@ -1268,7 +1268,7 @@ impl DocTestKinds {
1268
1268
opts,
1269
1269
edition,
1270
1270
path,
1271
- unused_externs,
1271
+ Arc :: clone ( unused_externs) ,
1272
1272
) ) ;
1273
1273
} else {
1274
1274
self . others . entry ( edition) . or_default ( ) . push ( doctest) ;
@@ -1280,6 +1280,7 @@ impl DocTestKinds {
1280
1280
mut test_args : Vec < String > ,
1281
1281
nocapture : bool ,
1282
1282
opts : GlobalTestOptions ,
1283
+ unused_externs : & Arc < Mutex < Vec < UnusedExterns > > > ,
1283
1284
) {
1284
1285
test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
1285
1286
if nocapture {
@@ -1305,7 +1306,7 @@ impl DocTestKinds {
1305
1306
let outdir = Arc :: clone ( & doctests[ 0 ] . outdir ) ;
1306
1307
1307
1308
let mut supports_color = true ;
1308
- for ( pos, doctest) in doctests. into_iter ( ) . enumerate ( ) {
1309
+ for ( pos, doctest) in doctests. iter ( ) . enumerate ( ) {
1309
1310
if !ids. is_empty ( ) {
1310
1311
ids. push ( ',' ) ;
1311
1312
}
@@ -1336,7 +1337,17 @@ fn main() {{
1336
1337
PathBuf :: from ( format ! ( "doctest_edition_{edition}.rs" ) ) ,
1337
1338
|_: UnusedExterns | { } ,
1338
1339
) {
1339
- // FIXME: run all tests one by one.
1340
+ // We failed to compile all compatible tests as one so we push them into the
1341
+ // "standalone" doctests.
1342
+ debug ! ( "Failed to compile compatible doctests for edition {edition} all at once" ) ;
1343
+ for ( pos, doctest) in doctests. into_iter ( ) . enumerate ( ) {
1344
+ standalone. push ( doctest. generate_test_desc_and_fn (
1345
+ & opts,
1346
+ edition,
1347
+ format ! ( "doctest_{edition}_{pos}" ) . into ( ) ,
1348
+ Arc :: clone ( unused_externs) ,
1349
+ ) ) ;
1350
+ }
1340
1351
}
1341
1352
}
1342
1353
@@ -1500,13 +1511,7 @@ impl Tester for Collector {
1500
1511
test_id,
1501
1512
& target_str,
1502
1513
) ;
1503
- self . tests . add_doctest (
1504
- doctest,
1505
- & opts,
1506
- edition,
1507
- path,
1508
- Arc :: clone ( & self . unused_extern_reports ) ,
1509
- ) ;
1514
+ self . tests . add_doctest ( doctest, & opts, edition, path, & self . unused_extern_reports ) ;
1510
1515
}
1511
1516
1512
1517
fn get_line ( & self ) -> usize {
0 commit comments