From: Guillaume Gomez Date: Sat, 2 Sep 2017 20:03:12 +0000 (+0200) Subject: Add precision for rustdoc block codes X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ebc195d292e959606e5bf01aa76a6b17ab4a1357;p=rust.git Add precision for rustdoc block codes --- diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index 348fcd3b769..eb3e6a9dd50 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -16,6 +16,19 @@ The basic idea is this: The triple backticks start and end code blocks. If this were in a file named `foo.rs`, running `rustdoc --test foo.rs` will extract this example, and then run it as a test. +Please note that by default, if no language is set for the block code, `rustdoc` +assumes it is `Rust` code. So the following: + +```rust +let x = 5; +``` + +is strictly equivalent to: + +``` +let x = 5; +``` + There's some subtlety though! Read on for more details. ## Pre-processing examples