diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-12 21:55:26 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-12 22:41:10 +0100 |
| commit | a06fd1f4f4b71b0571f2c1f35e981a1863638765 (patch) | |
| tree | ff6445783e9d3f5659ee45c3554b496ded7bde70 | |
| parent | 5e154fae925792096b11a6f6f30fc80f7362a6cf (diff) | |
| download | rust-a06fd1f4f4b71b0571f2c1f35e981a1863638765.tar.gz rust-a06fd1f4f4b71b0571f2c1f35e981a1863638765.zip | |
Ensure that INVALID_CODEBLOCK_ATTRIBUTES lint is emitted
| -rw-r--r-- | src/test/rustdoc-ui/check-fail.rs | 15 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/check-fail.stderr | 60 |
2 files changed, 47 insertions, 28 deletions
diff --git a/src/test/rustdoc-ui/check-fail.rs b/src/test/rustdoc-ui/check-fail.rs index ccc9d24c159..291fc112c34 100644 --- a/src/test/rustdoc-ui/check-fail.rs +++ b/src/test/rustdoc-ui/check-fail.rs @@ -1,10 +1,21 @@ // compile-flags: -Z unstable-options --check #![deny(missing_docs)] -//~^ ERROR -//~^^ ERROR #![deny(rustdoc)] +//! ```rust,testharness +//~^ ERROR +//! let x = 12; +//! ``` + pub fn foo() {} //~^ ERROR //~^^ ERROR + +/// hello +//~^ ERROR +/// +/// ```rust,testharness +/// let x = 12; +/// ``` +pub fn bar() {} diff --git a/src/test/rustdoc-ui/check-fail.stderr b/src/test/rustdoc-ui/check-fail.stderr index 979b2292f60..b4f255642da 100644 --- a/src/test/rustdoc-ui/check-fail.stderr +++ b/src/test/rustdoc-ui/check-fail.stderr @@ -1,13 +1,8 @@ -error: missing documentation for the crate - --> $DIR/check-fail.rs:3:1 +error: missing documentation for a function + --> $DIR/check-fail.rs:11:1 | -LL | / #![deny(missing_docs)] -LL | | -LL | | -LL | | #![deny(rustdoc)] -LL | | -LL | | pub fn foo() {} - | |_______________^ +LL | pub fn foo() {} + | ^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/check-fail.rs:3:9 @@ -15,35 +10,48 @@ note: the lint level is defined here LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ -error: missing documentation for a function - --> $DIR/check-fail.rs:8:1 +error: missing code example in this documentation + --> $DIR/check-fail.rs:11:1 | LL | pub fn foo() {} - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/check-fail.rs:4:9 + | +LL | #![deny(rustdoc)] + | ^^^^^^^ + = note: `#[deny(missing_doc_code_examples)]` implied by `#[deny(rustdoc)]` -error: missing code example in this documentation - --> $DIR/check-fail.rs:3:1 +error: unknown attribute `testharness`. Did you mean `test_harness`? + --> $DIR/check-fail.rs:6:1 | -LL | / #![deny(missing_docs)] -LL | | -LL | | -LL | | #![deny(rustdoc)] +LL | / //! ```rust,testharness LL | | -LL | | pub fn foo() {} - | |_______________^ +LL | | //! let x = 12; +LL | | //! ``` + | |_______^ | note: the lint level is defined here - --> $DIR/check-fail.rs:6:9 + --> $DIR/check-fail.rs:4:9 | LL | #![deny(rustdoc)] | ^^^^^^^ - = note: `#[deny(missing_doc_code_examples)]` implied by `#[deny(rustdoc)]` + = note: `#[deny(invalid_codeblock_attributes)]` implied by `#[deny(rustdoc)]` + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -error: missing code example in this documentation - --> $DIR/check-fail.rs:8:1 +error: unknown attribute `testharness`. Did you mean `test_harness`? + --> $DIR/check-fail.rs:15:1 | -LL | pub fn foo() {} - | ^^^^^^^^^^^^^^^ +LL | / /// hello +LL | | +LL | | /// +LL | | /// ```rust,testharness +LL | | /// let x = 12; +LL | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function error: aborting due to 4 previous errors |
