@@ -225,7 +225,7 @@ pub(crate) fn run(
225225 } )
226226 } ) ?;
227227
228- tests. run_tests ( test_args, nocapture, opts) ;
228+ tests. run_tests ( test_args, nocapture, opts, & unused_extern_reports ) ;
229229
230230 // Collect and warn about unused externs, but only if we've gotten
231231 // reports for each doctest
@@ -1256,7 +1256,7 @@ impl DocTestKinds {
12561256 opts : & GlobalTestOptions ,
12571257 edition : Edition ,
12581258 path : PathBuf ,
1259- unused_externs : Arc < Mutex < Vec < UnusedExterns > > > ,
1259+ unused_externs : & Arc < Mutex < Vec < UnusedExterns > > > ,
12601260 ) {
12611261 if doctest. failed_ast
12621262 || doctest. lang_string . compile_fail
@@ -1268,7 +1268,7 @@ impl DocTestKinds {
12681268 opts,
12691269 edition,
12701270 path,
1271- unused_externs,
1271+ Arc :: clone ( unused_externs) ,
12721272 ) ) ;
12731273 } else {
12741274 self . others . entry ( edition) . or_default ( ) . push ( doctest) ;
@@ -1280,6 +1280,7 @@ impl DocTestKinds {
12801280 mut test_args : Vec < String > ,
12811281 nocapture : bool ,
12821282 opts : GlobalTestOptions ,
1283+ unused_externs : & Arc < Mutex < Vec < UnusedExterns > > > ,
12831284 ) {
12841285 test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
12851286 if nocapture {
@@ -1305,7 +1306,7 @@ impl DocTestKinds {
13051306 let outdir = Arc :: clone ( & doctests[ 0 ] . outdir ) ;
13061307
13071308 let mut supports_color = true ;
1308- for ( pos, doctest) in doctests. into_iter ( ) . enumerate ( ) {
1309+ for ( pos, doctest) in doctests. iter ( ) . enumerate ( ) {
13091310 if !ids. is_empty ( ) {
13101311 ids. push ( ',' ) ;
13111312 }
@@ -1336,7 +1337,17 @@ fn main() {{
13361337 PathBuf :: from ( format ! ( "doctest_edition_{edition}.rs" ) ) ,
13371338 |_: UnusedExterns | { } ,
13381339 ) {
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+ }
13401351 }
13411352 }
13421353
@@ -1500,13 +1511,7 @@ impl Tester for Collector {
15001511 test_id,
15011512 & target_str,
15021513 ) ;
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 ) ;
15101515 }
15111516
15121517 fn get_line ( & self ) -> usize {
0 commit comments