|
| 1 | +// Test to ensure that `&` are handled the same way for generics and |
| 2 | +// for other "normal" types. |
| 3 | + |
| 4 | +#![crate_name = "foo"] |
| 5 | + |
| 6 | +// @has 'foo/trait.Trait.html' |
| 7 | + |
| 8 | +pub struct Struct; |
| 9 | + |
| 10 | +pub trait Trait<Rhs = Self> { |
| 11 | + // There should only be one `<a>` (not linking to reference primitive). |
| 12 | + // @count - '//*[@id="tymethod.method"]/*[@class="code-header"]/a' 1 |
| 13 | + // @has - '//*[@id="tymethod.method"]/*[@class="code-header"]/a' 'method' |
| 14 | + fn method(&self, other: &Rhs); |
| 15 | + // There should only be one `<a>` (method and `*const`). |
| 16 | + // @count - '//*[@id="tymethod.method2"]/*[@class="code-header"]/a' 2 |
| 17 | + // @has - '//*[@id="tymethod.method2"]/*[@class="code-header"]/a' 'method2' |
| 18 | + // @has - '//*[@id="tymethod.method2"]/*[@class="code-header"]/a' '*const' |
| 19 | + fn method2(&self, other: *const Rhs); |
| 20 | + // There should be only one `<a>` (just the method). |
| 21 | + // @count - '//*[@id="tymethod.bar"]/*[@class="code-header"]/a' 1 |
| 22 | + // @has - '//*[@id="tymethod.bar"]/*[@class="code-header"]/a' 'bar' |
| 23 | + fn bar(&self, other: Rhs); |
| 24 | + // There should be two `<a>` (method and `Struct`). |
| 25 | + // @count - '//*[@id="tymethod.foo"]/*[@class="code-header"]/a' 2 |
| 26 | + // @has - '//*[@id="tymethod.foo"]/*[@class="code-header"]/a' 'foo' |
| 27 | + // @has - '//*[@id="tymethod.foo"]/*[@class="code-header"]/a' 'Struct' |
| 28 | + fn foo(&self, other: &Struct); |
| 29 | + // There should be three `<a>` (method, `Struct` and `*const`). |
| 30 | + // @count - '//*[@id="tymethod.foo2"]/*[@class="code-header"]/a' 3 |
| 31 | + // @has - '//*[@id="tymethod.foo2"]/*[@class="code-header"]/a' 'foo2' |
| 32 | + // @has - '//*[@id="tymethod.foo2"]/*[@class="code-header"]/a' 'Struct' |
| 33 | + // @has - '//*[@id="tymethod.foo2"]/*[@class="code-header"]/a' '*const' |
| 34 | + fn foo2(&self, other: *const Struct); |
| 35 | + // There should be only one `<a>` (just the method). |
| 36 | + // @count - '//*[@id="tymethod.tuple"]/*[@class="code-header"]/a' 1 |
| 37 | + // @has - '//*[@id="tymethod.tuple"]/*[@class="code-header"]/a' 'tuple' |
| 38 | + fn tuple(&self, other: (Rhs, Rhs)); |
| 39 | + // There should be two `<a>` (method and `Struct`). |
| 40 | + // @count - '//*[@id="tymethod.tuple2"]/*[@class="code-header"]/a' 2 |
| 41 | + // @has - '//*[@id="tymethod.tuple2"]/*[@class="code-header"]/a' 'tuple2' |
| 42 | + // @has - '//*[@id="tymethod.tuple2"]/*[@class="code-header"]/a' 'Struct' |
| 43 | + fn tuple2(&self, other: (Struct, Rhs)); |
| 44 | + // There should be only one `<a>` (just the method). |
| 45 | + // @count - '//*[@id="tymethod.slice"]/*[@class="code-header"]/a' 1 |
| 46 | + // @has - '//*[@id="tymethod.slice"]/*[@class="code-header"]/a' 'slice' |
| 47 | + fn slice(&self, other: &[Rhs]); |
| 48 | + // There should be two `<a>` (method and `Struct`). |
| 49 | + // @count - '//*[@id="tymethod.slice2"]/*[@class="code-header"]/a' 2 |
| 50 | + // @has - '//*[@id="tymethod.slice2"]/*[@class="code-header"]/a' 'slice2' |
| 51 | + // @has - '//*[@id="tymethod.slice2"]/*[@class="code-header"]/a' 'Struct' |
| 52 | + fn slice2(&self, other: &[Struct]); |
| 53 | + // There should be two `<a>` (the method and one for the array primitive). |
| 54 | + // @count - '//*[@id="tymethod.array"]/*[@class="code-header"]/a' 2 |
| 55 | + // @has - '//*[@id="tymethod.array"]/*[@class="code-header"]/a' 'array' |
| 56 | + // @has - '//*[@id="tymethod.array"]/*[@class="code-header"]/a' '2' |
| 57 | + fn array(&self, other: [Rhs; 2]); |
| 58 | + // There should be two `<a>` (method, `Struct` and array primitive). |
| 59 | + // @count - '//*[@id="tymethod.array2"]/*[@class="code-header"]/a' 3 |
| 60 | + // @has - '//*[@id="tymethod.array2"]/*[@class="code-header"]/a' 'array2' |
| 61 | + // @has - '//*[@id="tymethod.array2"]/*[@class="code-header"]/a' 'Struct' |
| 62 | + // @has - '//*[@id="tymethod.array2"]/*[@class="code-header"]/a' '2' |
| 63 | + fn array2(&self, other: [Struct; 2]); |
| 64 | +} |
0 commit comments