diff options
| author | bors <bors@rust-lang.org> | 2019-08-31 20:10:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-31 20:10:20 +0000 |
| commit | 59cc53e6e708e9b9e86822c1b4d69f28f6c45eae (patch) | |
| tree | 5e6317bc94dc6a4871889566a732069c47aae95b /src/test/rustdoc-ui | |
| parent | fba38ac27e2ade309f4c2504a6d6cd3556972a28 (diff) | |
| parent | 0ec2e9fcebd18d98a32884786e1c4bbaf3db1ce0 (diff) | |
| download | rust-59cc53e6e708e9b9e86822c1b4d69f28f6c45eae.tar.gz rust-59cc53e6e708e9b9e86822c1b4d69f28f6c45eae.zip | |
Auto merge of #63703 - tommilligan:warn-empty-doctest, r=ollie27
rustdoc: warn on empty doc test Closes #60319. A doc test that only contains whitespace should result in a warning. This PR adds detection of empty doc tests to `check-code-block-syntax`, as having an invalid doc test is mutually exclusive with an empty doc test.
Diffstat (limited to 'src/test/rustdoc-ui')
| -rw-r--r-- | src/test/rustdoc-ui/invalid-syntax.rs | 10 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/invalid-syntax.stderr | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/invalid-syntax.rs b/src/test/rustdoc-ui/invalid-syntax.rs index 2b02d47d4b8..3ef66e273d0 100644 --- a/src/test/rustdoc-ui/invalid-syntax.rs +++ b/src/test/rustdoc-ui/invalid-syntax.rs @@ -64,3 +64,13 @@ pub fn blargh() {} /// \_ #[doc = "```"] pub fn crazy_attrs() {} + +/// ```rust +/// ``` +pub fn empty_rust() {} + +/// ``` +/// +/// +/// ``` +pub fn empty_rust_with_whitespace() {} diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr index 3bebbecb9df..36209e29277 100644 --- a/src/test/rustdoc-ui/invalid-syntax.stderr +++ b/src/test/rustdoc-ui/invalid-syntax.stderr @@ -179,6 +179,28 @@ LL | | #[doc = "```"] | = help: mark blocks that do not contain Rust code as text: ```text +warning: Rust code block is empty + --> $DIR/invalid-syntax.rs:68:5 + | +LL | /// ```rust + | _____^ +LL | | /// ``` + | |_______^ + +warning: Rust code block is empty + --> $DIR/invalid-syntax.rs:72:5 + | +LL | /// ``` + | _____^ +LL | | /// +LL | | /// +LL | | /// ``` + | |_______^ +help: mark blocks that do not contain Rust code as text + | +LL | /// ```text + | ^^^^^^^ + error: unknown start of token: \ --> <rustdoc-highlighting>:1:1 | |
