File tree 3 files changed +35
-1
lines changed
src/librustdoc/html/render
3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use crate::clean;
12
12
use crate :: formats:: Impl ;
13
13
use crate :: formats:: item_type:: ItemType ;
14
14
use crate :: html:: markdown:: { IdMap , MarkdownWithToc } ;
15
+ use crate :: html:: render:: print_item:: compare_names;
15
16
16
17
#[ derive( Clone , Copy ) ]
17
18
pub ( crate ) enum ModuleLike {
@@ -297,7 +298,7 @@ fn sidebar_trait<'a>(
297
298
. filter_map ( |i| super :: extract_for_impl_name ( & i. impl_item , cx) )
298
299
. map ( |( name, id) | Link :: new ( id, name) ) ,
299
300
) ;
300
- foreign_impls. sort ( ) ;
301
+ foreign_impls. sort_by ( |a , b| compare_names ( & a . name , & b . name ) ) ;
301
302
}
302
303
303
304
blocks. extend (
Original file line number Diff line number Diff line change
1
+ // Checks sidebar resizing close the Settings popover
2
+ go-to: "file://" + |DOC_PATH| + "/test_docs/SidebarSort/trait.SidebarFoo.html#foreign-impls"
3
+
4
+ // Check that the sidebar contains the expected foreign implementations
5
+ assert-text: (".sidebar-elems section ul > li:nth-child(1)", "&'a str")
6
+ assert-text: (".sidebar-elems section ul > li:nth-child(2)", "AtomicBool")
7
+ assert-text: (".sidebar-elems section ul > li:nth-child(3)", "AtomicU8")
8
+ assert-text: (".sidebar-elems section ul > li:nth-child(4)", "AtomicU16")
9
+ assert-text: (".sidebar-elems section ul > li:nth-child(5)", "AtomicU32")
10
+ assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Cell<u8>")
11
+ assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Cell<u16>")
12
+ assert-text: (".sidebar-elems section ul > li:nth-child(8)", "u8")
13
+ assert-text: (".sidebar-elems section ul > li:nth-child(9)", "u16")
14
+ assert-text: (".sidebar-elems section ul > li:nth-child(10)", "u32")
15
+ assert-text: (".sidebar-elems section ul > li:nth-child(11)", "usize")
Original file line number Diff line number Diff line change @@ -713,3 +713,21 @@ pub trait ItemsTrait {
713
713
/// blablala
714
714
fn bar ( ) ;
715
715
}
716
+
717
+ pub mod SidebarSort {
718
+ use std:: cell:: Cell ;
719
+ use std:: sync:: atomic:: * ;
720
+ pub trait SidebarFoo { }
721
+
722
+ impl SidebarFoo for u32 { }
723
+ impl SidebarFoo for u8 { }
724
+ impl SidebarFoo for u16 { }
725
+ impl SidebarFoo for usize { }
726
+ impl SidebarFoo for AtomicU32 { }
727
+ impl SidebarFoo for AtomicU16 { }
728
+ impl SidebarFoo for AtomicU8 { }
729
+ impl SidebarFoo for AtomicBool { }
730
+ impl SidebarFoo for Cell < u16 > { }
731
+ impl SidebarFoo for Cell < u8 > { }
732
+ impl < ' a > SidebarFoo for & ' a str { }
733
+ }
You can’t perform that action at this time.
0 commit comments