about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-01-03 17:09:01 +0100
committerGitHub <noreply@github.com>2021-01-03 17:09:01 +0100
commit2686daa7791865d7970fba2b9d6e6db279666a41 (patch)
treeb4c100285b7fa8e271f16feb3ba6af74ea0cacbb /src/test/rustdoc-ui
parentbcd69750794b315d7c673351f86cacdf5232a0b7 (diff)
parent7bc1eb4506170e0750de4757af97f341c427a35a (diff)
downloadrust-2686daa7791865d7970fba2b9d6e6db279666a41.tar.gz
rust-2686daa7791865d7970fba2b9d6e6db279666a41.zip
Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514
Add suggestion for "ignore" doc code block

Part of https://github.com/rust-lang/rust/issues/30032.

This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.

r? `@jyn514`
Diffstat (limited to 'src/test/rustdoc-ui')
-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
+