]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/intra-links.rs
Rollup merge of #53506 - phungleson:fix-from-docs-atomic, r=KodrAus
[rust.git] / src / test / rustdoc / intra-links.rs
1 // Copyright 2017 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 intra_links/index.html
12 // @has - '//a/@href' '../intra_links/struct.ThisType.html'
13 // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
14 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
15 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html#ThisVariant.v'
16 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html'
17 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html#tymethod.this_associated_method'
18 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedtype.ThisAssociatedType'
19 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedconstant.THIS_ASSOCIATED_CONST'
20 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html'
21 // @has - '//a/@href' '../intra_links/type.ThisAlias.html'
22 // @has - '//a/@href' '../intra_links/union.ThisUnion.html'
23 // @has - '//a/@href' '../intra_links/fn.this_function.html'
24 // @has - '//a/@href' '../intra_links/constant.THIS_CONST.html'
25 // @has - '//a/@href' '../intra_links/static.THIS_STATIC.html'
26 // @has - '//a/@href' '../intra_links/macro.this_macro.html'
27 // @has - '//a/@href' '../intra_links/trait.SoAmbiguous.html'
28 // @has - '//a/@href' '../intra_links/fn.SoAmbiguous.html'
29 //! In this crate we would like to link to:
30 //!
31 //! * [`ThisType`](ThisType)
32 //! * [`ThisType::this_method`](ThisType::this_method)
33 //! * [`ThisEnum`](ThisEnum)
34 //! * [`ThisEnum::ThisVariant`](ThisEnum::ThisVariant)
35 //! * [`ThisTrait`](ThisTrait)
36 //! * [`ThisTrait::this_associated_method`](ThisTrait::this_associated_method)
37 //! * [`ThisTrait::ThisAssociatedType`](ThisTrait::ThisAssociatedType)
38 //! * [`ThisTrait::THIS_ASSOCIATED_CONST`](ThisTrait::THIS_ASSOCIATED_CONST)
39 //! * [`ThisAlias`](ThisAlias)
40 //! * [`ThisUnion`](ThisUnion)
41 //! * [`this_function`](this_function())
42 //! * [`THIS_CONST`](const@THIS_CONST)
43 //! * [`THIS_STATIC`](static@THIS_STATIC)
44 //! * [`this_macro`](this_macro!)
45 //!
46 //! In addition, there's some specifics we want to look at. There's [a trait called
47 //! SoAmbiguous][ambig-trait], but there's also [a function called SoAmbiguous][ambig-fn] too!
48 //! Whatever shall we do?
49 //!
50 //! [ambig-trait]: trait@SoAmbiguous
51 //! [ambig-fn]: SoAmbiguous()
52
53 #[macro_export]
54 macro_rules! this_macro {
55     () => {};
56 }
57
58 pub struct ThisType;
59
60 impl ThisType {
61     pub fn this_method() {}
62 }
63 pub enum ThisEnum { ThisVariant, }
64 pub trait ThisTrait {
65     type ThisAssociatedType;
66     const THIS_ASSOCIATED_CONST: u8;
67     fn this_associated_method();
68 }
69 pub type ThisAlias = Result<(), ()>;
70 pub union ThisUnion { this_field: usize, }
71
72 pub fn this_function() {}
73 pub const THIS_CONST: usize = 5usize;
74 pub static THIS_STATIC: usize = 5usize;
75
76 pub trait SoAmbiguous {}
77
78 #[allow(nonstandard_style)]
79 pub fn SoAmbiguous() {}
80
81
82 // @has - '//a/@href' '../intra_links/struct.ThisType.html'
83 // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
84 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
85 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html#ThisVariant.v'
86 /// Shortcut links for:
87 /// * [`ThisType`]
88 /// * [`ThisType::this_method`]
89 /// * [ThisEnum]
90 /// * [ThisEnum::ThisVariant]
91 pub struct SomeOtherType;