diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-06-09 05:42:27 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-06-09 05:42:27 +0530 |
| commit | 554f595b864a9dc333fa8bb42c3e0a04b0b3e48a (patch) | |
| tree | dfd4fc58c20577a48f0729bbe76962dfa56ae23d /src/doc/trpl | |
| parent | a387078c62531e144b06d160475310fe9ce5d5f9 (diff) | |
| parent | 675b3decadc149b400d9afc4c59e0703a0b100ff (diff) | |
| download | rust-554f595b864a9dc333fa8bb42c3e0a04b0b3e48a.tar.gz rust-554f595b864a9dc333fa8bb42c3e0a04b0b3e48a.zip | |
Rollup merge of #26073 - chuckSMASH:trpl-5-4-comments, r=steveklabnik
For a user following the path of reading Chapter 5: Syntax & Symantics prior to Chapter 4: Learn Rust, this will be the first time they have encountered executable tests inside documentation comments. The test will fail because the `add_one` function is not defined in the context of the doctest. This might not be the optimal place to introduce and explain the `/// #` notation but I think it is important that this snippet pass as a test when `rustdoc --test` is run against it.
Diffstat (limited to 'src/doc/trpl')
| -rw-r--r-- | src/doc/trpl/comments.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/doc/trpl/comments.md b/src/doc/trpl/comments.md index fa27d1c226c..7687d2a57da 100644 --- a/src/doc/trpl/comments.md +++ b/src/doc/trpl/comments.md @@ -29,6 +29,9 @@ The other kind of comment is a doc comment. Doc comments use `///` instead of /// let five = 5; /// /// assert_eq!(6, add_one(5)); +/// # fn add_one(x: i32) -> i32 { +/// # x + 1 +/// # } /// ``` fn add_one(x: i32) -> i32 { x + 1 |
