@@ -393,24 +393,6 @@ pub enum DocFragmentKind {
393393 /// A doc fragment created from a `#[doc(include="filename")]` attribute. Contains both the
394394 /// given filename and the file contents.
395395 Include { filename : String } ,
396- /// A doc fragment used to distinguish between documentation in different modules.
397- ///
398- /// In particular, this prevents `collapse_docs` from turning all documentation comments
399- /// into a single giant attributes even when the item is re-exported with documentation on the re-export.
400- Divider ,
401- }
402-
403- impl DocFragment {
404- /// Creates a dummy doc-fragment which divides earlier and later fragments.
405- fn divider ( ) -> Self {
406- DocFragment {
407- line : 0 ,
408- span : DUMMY_SP ,
409- parent_module : None ,
410- doc : String :: new ( ) ,
411- kind : DocFragmentKind :: Divider ,
412- }
413- }
414396}
415397
416398impl < ' a > FromIterator < & ' a DocFragment > for String {
@@ -551,7 +533,7 @@ impl Attributes {
551533 attrs : & [ ast:: Attribute ] ,
552534 additional_attrs : Option < ( & [ ast:: Attribute ] , DefId ) > ,
553535 ) -> Attributes {
554- let doc_strings = RefCell :: new ( vec ! [ ] ) ;
536+ let mut doc_strings = vec ! [ ] ;
555537 let mut sp = None ;
556538 let mut cfg = Cfg :: True ;
557539 let mut doc_line = 0 ;
@@ -568,7 +550,7 @@ impl Attributes {
568550
569551 let line = doc_line;
570552 doc_line += value. lines ( ) . count ( ) ;
571- doc_strings. borrow_mut ( ) . push ( DocFragment {
553+ doc_strings. push ( DocFragment {
572554 line,
573555 span : attr. span ,
574556 doc : value,
@@ -593,7 +575,7 @@ impl Attributes {
593575 {
594576 let line = doc_line;
595577 doc_line += contents. lines ( ) . count ( ) ;
596- doc_strings. borrow_mut ( ) . push ( DocFragment {
578+ doc_strings. push ( DocFragment {
597579 line,
598580 span : attr. span ,
599581 doc : contents,
@@ -610,10 +592,7 @@ impl Attributes {
610592 // Additional documentation should be shown before the original documentation
611593 let other_attrs = additional_attrs
612594 . into_iter ( )
613- . map ( |( attrs, id) | {
614- doc_strings. borrow_mut ( ) . push ( DocFragment :: divider ( ) ) ;
615- attrs. iter ( ) . map ( move |attr| ( attr, Some ( id) ) )
616- } )
595+ . map ( |( attrs, id) | attrs. iter ( ) . map ( move |attr| ( attr, Some ( id) ) ) )
617596 . flatten ( )
618597 . chain ( attrs. iter ( ) . map ( |attr| ( attr, None ) ) )
619598 . filter_map ( clean_attr)
@@ -642,7 +621,7 @@ impl Attributes {
642621 . map_or ( true , |a| a. style == AttrStyle :: Inner ) ;
643622
644623 Attributes {
645- doc_strings : doc_strings . into_inner ( ) ,
624+ doc_strings,
646625 other_attrs,
647626 cfg : if cfg == Cfg :: True { None } else { Some ( Arc :: new ( cfg) ) } ,
648627 span : sp,
0 commit comments