diff options
| -rw-r--r-- | src/doc/rustdoc/src/write-documentation/documentation-tests.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/documentation-tests.md b/src/doc/rustdoc/src/write-documentation/documentation-tests.md index e6b15e0dbd3..4084c1d962a 100644 --- a/src/doc/rustdoc/src/write-documentation/documentation-tests.md +++ b/src/doc/rustdoc/src/write-documentation/documentation-tests.md @@ -191,6 +191,20 @@ We can document it by escaping the initial `#`: /// ## bar # baz"; ``` +Here is an example with a macro rule which matches on tokens starting with `#`: + +`````rust,no_run +/// ``` +/// macro_rules! ignore { (##tag) => {}; } +/// ignore! { +/// ###tag +/// } +/// ``` +# fn f() {} +````` + +As you can see, the rule is expecting two `#`, so when calling it, we need to add an extra `#` +because the first one is used as escape. ## Using `?` in doc tests |
