Skip to content

Commit f96aff9

Browse files
Add regression test for impl associated items sorting
1 parent a459403 commit f96aff9

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This test ensures that impl associated items always follow this order:
2+
//
3+
// 1. Types
4+
// 2. Consts
5+
// 3. Functions
6+
7+
#![feature(inherent_associated_types)]
8+
#![allow(incomplete_features)]
9+
#![crate_name = "foo"]
10+
11+
//@ has 'foo/struct.Bar.html'
12+
pubstructBar;
13+
14+
implBar{
15+
//@ has - '//*[@id="implementations-list"]//*[@class="impl-items"]/section[3]/h4' \
16+
// 'pub fn foo()'
17+
pubfnfoo(){}
18+
//@ has - '//*[@id="implementations-list"]//*[@class="impl-items"]/section[2]/h4' \
19+
// 'pub const X: u8 = 12u8'
20+
pubconstX:u8 = 12;
21+
//@ has - '//*[@id="implementations-list"]//*[@class="impl-items"]/section[1]/h4' \
22+
// 'pub type Y = u8'
23+
pubtypeY = u8;
24+
}
25+
26+
pubtraitFoo{
27+
constW:u32;
28+
fnyeay();
29+
typeZ;
30+
}
31+
32+
implFooforBar{
33+
//@ has - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]/section[2]/h4' \
34+
// 'const W: u32 = 12u32'
35+
constW:u32 = 12;
36+
//@ has - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]/section[1]/h4' \
37+
// 'type Z = u8'
38+
typeZ = u8;
39+
//@ has - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]/section[3]/h4' \
40+
// 'fn yeay()'
41+
fnyeay(){}
42+
}

0 commit comments

Comments
 (0)