]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-28478.rs
Rollup merge of #54147 - agnxy:const-eval-test, r=oli-obk
[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
13 // @has issue_28478/trait.Bar.html
14 pub trait Bar {
15     // @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
16     // @has - '//*[@href="#associatedtype.Bar"]' 'Bar'
17     type Bar = ();
18     // @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
19     // @has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
20     const Baz: usize = 7;
21     // @has - '//*[@id="tymethod.bar"]' 'fn bar'
22     fn bar();
23     // @has - '//*[@id="method.baz"]' 'fn baz'
24     fn baz() { }
25 }
26
27 // @has issue_28478/struct.Foo.html
28 pub struct Foo;
29
30 impl Foo {
31     // @has - '//*[@href="#method.foo"]' 'foo'
32     pub fn foo() {}
33 }
34
35 impl Bar for Foo {
36     // @has - '//*[@href="../issue_28478/trait.Bar.html#associatedtype.Bar"]' 'Bar'
37     // @has - '//*[@href="../issue_28478/trait.Bar.html#associatedconstant.Baz"]' 'Baz'
38     // @has - '//*[@href="../issue_28478/trait.Bar.html#tymethod.bar"]' 'bar'
39     fn bar() {}
40     // @has - '//*[@href="../issue_28478/trait.Bar.html#method.baz"]' 'baz'
41 }