]> git.proxmox.com Git - rustc.git/blob - src/test/rustdoc/issue-25001.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.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 pub fn pass() {}
23 }
24 impl Foo<u16> {
25 // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize'
26 pub fn pass() -> usize { 42 }
27 }
28 impl Foo<u32> {
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> {
34 // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T'
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> {
41 // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T"
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> {
48 // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T"
49 type Item=&'a mut T;
50
51 // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)'
52 fn quux(self) {}
53 }