]>
Commit | Line | Data |
---|---|---|
f9f354fc XL |
1 | An inner doc comment was used in an invalid context. |
2 | ||
3 | Erroneous code example: | |
4 | ||
5 | ```compile_fail,E0753 | |
6 | fn foo() {} | |
7 | //! foo | |
8 | // ^ error! | |
9 | fn main() {} | |
10 | ``` | |
11 | ||
12 | Inner document can only be used before items. For example: | |
13 | ||
14 | ``` | |
15 | //! A working comment applied to the module! | |
16 | fn foo() { | |
17 | //! Another working comment! | |
18 | } | |
19 | fn main() {} | |
20 | ``` | |
21 | ||
22 | In case you want to document the item following the doc comment, you might want | |
23 | to use outer doc comment: | |
24 | ||
25 | ``` | |
26 | /// I am an outer doc comment | |
27 | #[doc = "I am also an outer doc comment!"] | |
28 | fn foo() { | |
29 | // ... | |
30 | } | |
31 | ``` |