File tree Expand file tree Collapse file tree 2 files changed +50
-9
lines changed 
tests/rustdoc/inline_local Expand file tree Collapse file tree 2 files changed +50
-9
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,7 @@ impl DocFolder for CacheBuilder<'_, '_> {
305305            | clean:: MacroItem ( ..) 
306306            | clean:: ProcMacroItem ( ..) 
307307            | clean:: VariantItem ( ..)  => { 
308+                 use  rustc_data_structures:: fx:: IndexEntry  as  Entry ; 
308309                if  !self . cache . stripped_mod  { 
309310                    // Re-exported items mean that the same id can show up twice 
310311                    // in the rustdoc ast that we're looking at. We know, 
@@ -313,15 +314,15 @@ impl DocFolder for CacheBuilder<'_, '_> {
313314                    // paths map if there was already an entry present and we're 
314315                    // not a public item. 
315316                    let  item_def_id = item. item_id . expect_def_id ( ) ; 
316-                     if  ! self . cache . paths . contains_key ( & item_def_id) 
317-                         ||  self 
318-                             . cache 
319-                              . effective_visibilities 
320-                              . is_directly_public ( self . tcx ,  item_def_id ) 
321-                     { 
322-                         self . cache 
323-                             . paths 
324-                              . insert ( item_def_id ,   ( self . cache . stack . clone ( ) ,  item . type_ ( ) ) ) ; 
317+                     match   self . cache . paths . entry ( item_def_id)   { 
318+                         Entry :: Vacant ( entry )  =>  { 
319+                             entry . insert ( ( self . cache . stack . clone ( ) ,  item . type_ ( ) ) ) ; 
320+                         } 
321+                         Entry :: Occupied ( mut  entry )  =>  { 
322+                              if  entry . get ( ) . 0 . len ( )  >  self . cache . stack . len ( )   { 
323+                                 entry . insert ( ( self . cache . stack . clone ( ) ,  item . type_ ( ) ) ) ; 
324+                             } 
325+                         } 
325326                    } 
326327                } 
327328            } 
Original file line number Diff line number Diff line change 1+ //! Test case for [134702] 
2+ //! 
3+ //! [134702]: https://github.com/rust-lang/rust/issues/134702 
4+ #![ crate_name = "foo" ]  
5+ 
6+ pub  mod  inside1 { 
7+     pub  use  self :: inner:: Inside1 ; 
8+     mod  inner { 
9+         pub  struct  Inside1 ; 
10+         impl  Inside1  { 
11+             pub  fn  stuff ( self )  { } 
12+         } 
13+     } 
14+ } 
15+ 
16+ pub  mod  inside2 { 
17+     pub  use  self :: inner:: Inside2 ; 
18+     mod  inner { 
19+         pub  struct  Inside2 ; 
20+         impl  Inside2  { 
21+             pub  fn  stuff ( self )  { } 
22+         } 
23+     } 
24+ } 
25+ 
26+ pub  mod  nested { 
27+     //! [Inside1] [Inside2] 
28+ //@ has foo/nested/index.html '//a[@href="../struct.Inside1.html"]' 'Inside1' 
29+     //@ has foo/nested/index.html '//a[@href="../struct.Inside2.html"]' 'Inside2' 
30+     //! [Inside1::stuff] [Inside2::stuff] 
31+ //@ has foo/nested/index.html '//a[@href="../struct.Inside1.html#method.stuff"]' 'Inside1::stuff' 
32+     //@ has foo/nested/index.html '//a[@href="../struct.Inside2.html#method.stuff"]' 'Inside2::stuff' 
33+     use  crate :: inside1:: Inside1 ; 
34+     use  crate :: inside2:: Inside2 ; 
35+ } 
36+ 
37+ #[ doc( inline) ]  
38+ pub  use  inside1:: Inside1 ; 
39+ #[ doc( inline) ]  
40+ pub  use  inside2:: Inside2 ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments