]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0584.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0584.md
1 A doc comment that is not attached to anything has been encountered.
2
3 Erroneous code example:
4
5 ```compile_fail,E0584
6 trait Island {
7     fn lost();
8
9     /// I'm lost!
10 }
11 ```
12
13 A little reminder: a doc comment has to be placed before the item it's supposed
14 to document. So if you want to document the `Island` trait, you need to put a
15 doc comment before it, not inside it. Same goes for the `lost` method: the doc
16 comment needs to be before it:
17
18 ```
19 /// I'm THE island!
20 trait Island {
21     /// I'm lost!
22     fn lost();
23 }
24 ```