]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-28478.rs
493c08693e94a6d1e317f5d69000dff1d4792780
[rust.git] / src / test / rustdoc / issue-28478.rs
1 // Copyright 2016 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 #![feature(associated_type_defaults)]
12 #![feature(associated_consts)]
13
14 // @has issue_28478/trait.Bar.html
15 pub trait Bar {
16     // @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
17     // @has - '//*[@href="#associatedtype.Bar"]' 'Bar'
18     type Bar = ();
19     // @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
20     // @has - '//*[@class="docblock"]' 'Baz: usize = 7'
21     // @has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
22     const Baz: usize = 7;
23     // @has - '//*[@id="tymethod.bar"]' 'fn bar'
24     fn bar();
25     // @has - '//*[@id="method.baz"]' 'fn baz'
26     fn baz() { }
27 }
28
29 // @has issue_28478/struct.Foo.html
30 pub struct Foo;
31
32 impl Foo {
33     // @has - '//*[@href="#method.foo"]' 'foo'
34     pub fn foo() {}
35 }
36
37 impl Bar for Foo {
38     // @has - '//*[@href="../issue_28478/trait.Bar.html#associatedtype.Bar"]' 'Bar'
39     // @has - '//*[@href="../issue_28478/trait.Bar.html#associatedconstant.Baz"]' 'Baz'
40     // @has - '//*[@href="../issue_28478/trait.Bar.html#tymethod.bar"]' 'bar'
41     fn bar() {}
42     // @has - '//*[@href="../issue_28478/trait.Bar.html#method.baz"]' 'baz'
43 }