]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-ui/intra-links-anchors.rs
refactor and reword intra-doc link errors
[rust.git] / src / test / rustdoc-ui / intra-links-anchors.rs
1 #![deny(intra_doc_link_resolution_failure)]
2
3 // A few tests on anchors.
4
5 /// Hello people.
6 ///
7 /// You can anchors? Here's one!
8 ///
9 /// # hola
10 ///
11 /// Isn't it amazing?
12 pub struct Foo {
13     pub f: u8,
14 }
15
16 pub enum Enum {
17     A,
18     B,
19 }
20
21 /// Have you heard about stuff?
22 ///
23 /// Like [Foo#hola].
24 ///
25 /// Or maybe [Foo::f#hola].
26 //~^ ERROR `Foo::f#hola` contains an anchor
27 pub fn foo() {}
28
29 /// Empty.
30 ///
31 /// Another anchor error: [hello#people#!].
32 //~^ ERROR `hello#people#!` contains multiple anchors
33 pub fn bar() {}
34
35 /// Empty?
36 ///
37 /// Damn enum's variants: [Enum::A#whatever].
38 //~^ ERROR `Enum::A#whatever` contains an anchor
39 pub fn enum_link() {}
40
41 /// Primitives?
42 ///
43 /// [u32#hello]
44 //~^ ERROR `u32#hello` contains an anchor
45 pub fn x() {}