File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed 
src/cargo/ops/cargo_compile Expand file tree Collapse file tree 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>(
394394            } 
395395        } 
396396
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`]). 
397399        let  valid_units = all_units
398400            . into_iter ( ) 
399401            . 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+                     ) 
404407            } ) 
405408            . collect :: < Vec < _ > > ( ) ; 
406409        valid_units
Original file line number Diff line number Diff line change @@ -281,6 +281,36 @@ fn issue_10545() {
281281        . run ( ) ; 
282282} 
283283
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+ 
308+ [FINISHED] [..] 
309+ " , 
310+         ) 
311+         . run ( ) ; 
312+ } 
313+ 
284314#[ cargo_test( nightly,  reason = "rustdoc scrape examples flags are unstable" ) ]  
285315fn  cache ( )  { 
286316    let  p = project ( ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments