Skip to content

Commit ebc195d

Browse files
Add precision for rustdoc block codes
1 parent 2ffcfeb commit ebc195d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

+13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ The basic idea is this:
1616
The triple backticks start and end code blocks. If this were in a file named `foo.rs`,
1717
running `rustdoc --test foo.rs` will extract this example, and then run it as a test.
1818

19+
Please note that by default, if no language is set for the block code, `rustdoc`
20+
assumes it is `Rust` code. So the following:
21+
22+
```rust
23+
let x = 5;
24+
```
25+
26+
is strictly equivalent to:
27+
28+
```
29+
let x = 5;
30+
```
31+
1932
There's some subtlety though! Read on for more details.
2033

2134
## Pre-processing examples

0 commit comments

Comments
 (0)