Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/doc/rustdoc/src/write-documentation/documentation-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading