File tree 2 files changed +37
-4
lines changed
src/cargo/ops/cargo_compile
2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -394,13 +394,16 @@ pub fn create_bcx<'a, 'cfg>(
394
394
}
395
395
}
396
396
397
+ // We further eliminate units for scraping if they are explicitly marked to not be scraped,
398
+ // or if they aren't eligible for scraping (see [`Workspace::unit_needs_doc_scrape`]).
397
399
let valid_units = all_units
398
400
. into_iter ( )
399
401
. filter ( |unit| {
400
- !matches ! (
401
- unit. target. doc_scrape_examples( ) ,
402
- RustdocScrapeExamples :: Disabled
403
- )
402
+ ws. unit_needs_doc_scrape ( unit)
403
+ && !matches ! (
404
+ unit. target. doc_scrape_examples( ) ,
405
+ RustdocScrapeExamples :: Disabled
406
+ )
404
407
} )
405
408
. collect :: < Vec < _ > > ( ) ;
406
409
valid_units
Original file line number Diff line number Diff line change @@ -281,6 +281,36 @@ fn issue_10545() {
281
281
. run ( ) ;
282
282
}
283
283
284
+ #[ cargo_test( nightly, reason = "rustdoc scrape examples flags are unstable" ) ]
285
+ fn no_scrape_proc_macros_issue_10571 ( ) {
286
+ let p = project ( )
287
+ . file (
288
+ "Cargo.toml" ,
289
+ r#"
290
+ [package]
291
+ name = "foo"
292
+ version = "0.0.1"
293
+ authors = []
294
+
295
+ [lib]
296
+ proc-macro = true
297
+ "# ,
298
+ )
299
+ . file ( "src/lib.rs" , "" )
300
+ . build ( ) ;
301
+
302
+ // proc-macro library should not be scraped
303
+ p. cargo ( "doc -Zunstable-options -Zrustdoc-scrape-examples" )
304
+ . masquerade_as_nightly_cargo ( & [ "rustdoc-scrape-examples" ] )
305
+ . with_stderr (
306
+ "\
307
+ [DOCUMENTING] foo v0.0.1 ([CWD])
308
+ [FINISHED] [..]
309
+ " ,
310
+ )
311
+ . run ( ) ;
312
+ }
313
+
284
314
#[ cargo_test( nightly, reason = "rustdoc scrape examples flags are unstable" ) ]
285
315
fn cache ( ) {
286
316
let p = project ( )
You can’t perform that action at this time.
0 commit comments