-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #71214 - GuillaumeGomez:add-error-code-inner-doc-erro…
…r, r=Dylan-DPC Add error code for inner doc error r? @Dylan-DPC cc @oli-obk
- Loading branch information
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
An inner doc comment was used in an invalid context. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0753 | ||
fn foo() {} | ||
//! foo | ||
// ^ error! | ||
fn main() {} | ||
``` | ||
|
||
Inner document can only be used before items. For example: | ||
|
||
``` | ||
//! A working comment applied to the module! | ||
fn foo() { | ||
//! Another working comment! | ||
} | ||
fn main() {} | ||
``` | ||
|
||
In case you want to document the item following the doc comment, you might want | ||
to use outer doc comment: | ||
|
||
``` | ||
/// I am an outer doc comment | ||
#[doc = "I am also an outer doc comment!"] | ||
fn foo() { | ||
// ... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters