about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-01-01 16:05:36 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-01-01 16:34:22 +0100
commitc3ae82690150a9edc09ceef6319eabedfebf3931 (patch)
treed54faa7b105f7772668cc1b3bd6a80b4ed5f69d0
parent5bf5b127070b510dee82770b921aa39137c1d889 (diff)
downloadrust-c3ae82690150a9edc09ceef6319eabedfebf3931.tar.gz
rust-c3ae82690150a9edc09ceef6319eabedfebf3931.zip
Add test for suggestion in case a "ignore" doc block has invalid rust code inside
-rw-r--r--src/test/rustdoc-ui/ignore-block-help.rs7
-rw-r--r--src/test/rustdoc-ui/ignore-block-help.stderr17
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/ignore-block-help.rs b/src/test/rustdoc-ui/ignore-block-help.rs
new file mode 100644
index 00000000000..c22dddd11df
--- /dev/null
+++ b/src/test/rustdoc-ui/ignore-block-help.rs
@@ -0,0 +1,7 @@
+// check-pass
+
+/// ```ignore (to-prevent-tidy-error)
+/// let heart = '❤️';
+/// ```
+//~^^^ WARN
+pub struct X;
diff --git a/src/test/rustdoc-ui/ignore-block-help.stderr b/src/test/rustdoc-ui/ignore-block-help.stderr
new file mode 100644
index 00000000000..d45cd92d2d1
--- /dev/null
+++ b/src/test/rustdoc-ui/ignore-block-help.stderr
@@ -0,0 +1,17 @@
+warning: could not parse code block as Rust code
+  --> $DIR/ignore-block-help.rs:3:5
+   |
+LL |   /// ```ignore (to-prevent-tidy-error)
+   |  _____^
+LL | | /// let heart = '❤️';
+LL | | /// ```
+   | |_______^
+   |
+   = note: error from rustc: character literal may only contain one codepoint
+help: `ignore` code blocks require valid Rust code for syntax highlighting. Mark blocks that do not contain Rust code as text
+   |
+LL | /// ```text,ignore (to-prevent-tidy-error)
+   |     ^^^^^^^^
+
+warning: 1 warning emitted
+