]>
Commit | Line | Data |
---|---|---|
92a42be0 SL |
1 | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // @has issue_25001/struct.Foo.html | |
12 | pub struct Foo<T>(T); | |
13 | ||
14 | pub trait Bar { | |
15 | type Item; | |
16 | ||
17 | fn quux(self); | |
18 | } | |
19 | ||
54a0048b | 20 | impl Foo<u8> { |
92a42be0 SL |
21 | // @has - '//*[@id="method.pass"]//code' 'fn pass()' |
22 | pub fn pass() {} | |
23 | } | |
54a0048b | 24 | impl Foo<u16> { |
92a42be0 SL |
25 | // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize' |
26 | pub fn pass() -> usize { 42 } | |
27 | } | |
54a0048b | 28 | impl Foo<u32> { |
92a42be0 SL |
29 | // @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize' |
30 | pub fn pass() -> isize { 42 } | |
31 | } | |
32 | ||
33 | impl<T> Bar for Foo<T> { | |
7453a54e | 34 | // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T' |
92a42be0 SL |
35 | type Item=T; |
36 | ||
37 | // @has - '//*[@id="method.quux"]//code' 'fn quux(self)' | |
38 | fn quux(self) {} | |
39 | } | |
40 | impl<'a, T> Bar for &'a Foo<T> { | |
7453a54e | 41 | // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T" |
92a42be0 SL |
42 | type Item=&'a T; |
43 | ||
44 | // @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)' | |
45 | fn quux(self) {} | |
46 | } | |
47 | impl<'a, T> Bar for &'a mut Foo<T> { | |
7453a54e | 48 | // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T" |
92a42be0 SL |
49 | type Item=&'a mut T; |
50 | ||
51 | // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)' | |
52 | fn quux(self) {} | |
53 | } |