about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-23 13:28:04 +0000
committerbors <bors@rust-lang.org>2021-04-23 13:28:04 +0000
commit9a352326112e4fd993e339cbd4eabae06d4979b9 (patch)
tree3c8fbbcf924b3fabc760ba890470a3b7566403fe /src/test
parent236580bc5bed062ad3fc34f445af8e8a54713258 (diff)
parentaf6c3201fc3d5ec2559836454ea4f43eec583fa2 (diff)
downloadrust-9a352326112e4fd993e339cbd4eabae06d4979b9.tar.gz
rust-9a352326112e4fd993e339cbd4eabae06d4979b9.zip
Auto merge of #84445 - jyn514:hidden, r=<try>
rustdoc: Hide `#text` in doc-tests

Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.

Fixes https://github.com/rust-lang/rust/issues/83284.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/test-hidden.rs25
-rw-r--r--src/test/rustdoc-ui/test-hidden.stdout6
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/test-hidden.rs b/src/test/rustdoc-ui/test-hidden.rs
new file mode 100644
index 00000000000..9e068d4db4b
--- /dev/null
+++ b/src/test/rustdoc-ui/test-hidden.rs
@@ -0,0 +1,25 @@
+// check-pass
+// compile-flags:--test
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+
+/// ```
+// If `const_err` becomes a hard error in the future, please replace this with another
+// deny-by-default lint instead of removing it altogether
+/// # ! [allow(const_err)]
+/// const C: usize = 1/0;
+///
+/// # use std::path::PathBuf;
+/// #use std::path::Path;
+/// let x = Path::new("y.rs");
+/// let x = PathBuf::from("y.rs");
+///
+/// #[cfg(FALSE)]
+/// assert!(false);
+///
+/// # [cfg(FALSE)]
+/// assert!(false);
+/// ```
+fn main() {
+    panic!();
+}
diff --git a/src/test/rustdoc-ui/test-hidden.stdout b/src/test/rustdoc-ui/test-hidden.stdout
new file mode 100644
index 00000000000..89d98d6d688
--- /dev/null
+++ b/src/test/rustdoc-ui/test-hidden.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/test-hidden.rs - main (line 6) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+