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