]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-25001.rs
Auto merge of #35748 - michaelwoerister:fix-rust-gdb-py-version-check, r=brson
[rust.git] / src / test / rustdoc / issue-25001.rs
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
20 impl Foo<u8> {
21     // @has - '//*[@id="method.pass"]//code' 'fn pass()'
22     // @has - '//*[@id="pass.v"]//code' 'fn pass()'
23     pub fn pass() {}
24 }
25 impl Foo<u16> {
26     // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize'
27     // @has - '//*[@id="pass.v-1"]//code' 'fn pass() -> usize'
28     pub fn pass() -> usize { 42 }
29 }
30 impl Foo<u32> {
31     // @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize'
32     // @has - '//*[@id="pass.v-2"]//code' 'fn pass() -> isize'
33     pub fn pass() -> isize { 42 }
34 }
35
36 impl<T> Bar for Foo<T> {
37     // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T'
38     type Item=T;
39
40     // @has - '//*[@id="method.quux"]//code' 'fn quux(self)'
41     fn quux(self) {}
42 }
43 impl<'a, T> Bar for &'a Foo<T> {
44     // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T"
45     type Item=&'a T;
46
47     // @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)'
48     fn quux(self) {}
49 }
50 impl<'a, T> Bar for &'a mut Foo<T> {
51     // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T"
52     type Item=&'a mut T;
53
54     // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)'
55     fn quux(self) {}
56 }