File tree Expand file tree Collapse file tree 1 file changed +39
-4
lines changed Expand file tree Collapse file tree 1 file changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,53 @@ Here is the list of the lints provided by `rustdoc`:
13
13
14
14
## broken_intra_doc_links
15
15
16
- This lint ** warns by default** and is ** nightly-only** . This lint detects when
17
- an intra-doc link fails to get resolved. For example:
16
+ This lint ** warns by default** . This lint detects when an [ intra-doc link] fails to get resolved. For example:
17
+
18
+ [ intra-doc link ] : linking-to-items-by-name.html
18
19
19
20
``` rust
20
- /// I want to link to [`Inexistent `] but it doesn't exist!
21
+ /// I want to link to [`Nonexistent `] but it doesn't exist!
21
22
pub fn foo () {}
22
23
```
23
24
24
25
You'll get a warning saying:
25
26
26
27
``` text
27
- error: `[`Inexistent`]` cannot be resolved, ignoring it...
28
+ warning: `[Nonexistent]` cannot be resolved, ignoring it.
29
+ --> test.rs:1:24
30
+ |
31
+ 1 | /// I want to link to [`Nonexistent`] but it doesn't exist!
32
+ | ^^^^^^^^^^^^^ cannot be resolved, ignoring
33
+ ```
34
+
35
+ It will also warn when there is an ambiguity and suggest how to disambiguate:
36
+
37
+ ``` rust
38
+ /// [`Foo`]
39
+ pub fn function () {}
40
+
41
+ pub enum Foo {}
42
+
43
+ pub fn Foo (){}
44
+ ```
45
+
46
+ ``` text
47
+ warning: `Foo` is both an enum and a function
48
+ --> test.rs:1:6
49
+ |
50
+ 1 | /// [`Foo`]
51
+ | ^^^^^ ambiguous link
52
+ |
53
+ = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
54
+ help: to link to the enum, prefix with the item type
55
+ |
56
+ 1 | /// [`enum@Foo`]
57
+ | ^^^^^^^^^^
58
+ help: to link to the function, add parentheses
59
+ |
60
+ 1 | /// [`Foo()`]
61
+ | ^^^^^^^
62
+
28
63
```
29
64
30
65
## missing_docs
You can’t perform that action at this time.
0 commit comments