Skip to content

Commit bcba3b9

Browse files
Rollup merge of rust-lang#50852 - mandeep:fix-rustdoc-example-testing, r=GuillaumeGomez
Add doc comment to hiding portions of code example fixes rust-lang#50816 Not sure if this is all that's needed, but I think it's a good start. One thing to note is that the code block is a text block where it could possibly be a rust block.
2 parents 4122885 + 8d74cf8 commit bcba3b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/doc/rustdoc/src/documentation-tests.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ from your example, but are important to make the tests work. Consider
7979
an example block that looks like this:
8080

8181
```text
82-
/// Some documentation.
83-
# fn foo() {}
82+
/// /// Some documentation.
83+
/// # fn foo() {} // this function will be hidden
84+
/// println!("Hello, World!");
8485
```
8586

8687
It will render like this:
8788

8889
```rust
8990
/// Some documentation.
9091
# fn foo() {}
92+
println!("Hello, World!");
9193
```
9294

9395
Yes, that's right: you can add lines that start with `# `, and they will

0 commit comments

Comments
 (0)