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`:
1313
1414## broken_intra_doc_links
1515
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
1819
1920``` 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!
2122pub fn foo () {}
2223```
2324
2425You'll get a warning saying:
2526
2627``` 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+
2863```
2964
3065## missing_docs
You can’t perform that action at this time.
0 commit comments