diff options
| author | bors <bors@rust-lang.org> | 2021-04-24 20:35:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-24 20:35:12 +0000 |
| commit | 42816d61ead7e46d462df997958ccfd514f8c21c (patch) | |
| tree | 81b4fede693dfe508cd88d954fe43d28f385590d | |
| parent | 7e11f3a8f3c1b2683125e7def0acb68a6d684f92 (diff) | |
| parent | 5b05f687db08e267b2a9e2bc4eddf9d68136b221 (diff) | |
| download | rust-42816d61ead7e46d462df997958ccfd514f8c21c.tar.gz rust-42816d61ead7e46d462df997958ccfd514f8c21c.zip | |
Auto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomez
Revert "rustdoc: Hide `#text` in doc-tests" See discussion in #84502 - I'm worried that #84445 may cause a lot of breakages if this were to hit stable, so I think it's safer to revert and work on the known correct fix #84478.
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 19 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/test-hidden.rs | 25 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/test-hidden.stdout | 6 |
3 files changed, 6 insertions, 44 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index f1c9550b5ac..509f1730557 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -147,19 +147,12 @@ fn map_line(s: &str) -> Line<'_> { let trimmed = s.trim(); if trimmed.starts_with("##") { Line::Shown(Cow::Owned(s.replacen("##", "#", 1))) - } else if trimmed.starts_with('#') { - let mut without_hash = trimmed[1..].trim_start(); - if without_hash.starts_with('!') { - // #! text - without_hash = without_hash[1..].trim_start_matches(' '); - } - if without_hash.starts_with('[') { - // #[attr] or #![attr] - Line::Shown(Cow::Borrowed(s)) - } else { - // #text - Line::Hidden(without_hash) - } + } else if let Some(stripped) = trimmed.strip_prefix("# ") { + // # text + Line::Hidden(&stripped) + } else if trimmed == "#" { + // We cannot handle '#text' because it could be #[attr]. + Line::Hidden("") } else { Line::Shown(Cow::Borrowed(s)) } diff --git a/src/test/rustdoc-ui/test-hidden.rs b/src/test/rustdoc-ui/test-hidden.rs deleted file mode 100644 index 9e068d4db4b..00000000000 --- a/src/test/rustdoc-ui/test-hidden.rs +++ /dev/null @@ -1,25 +0,0 @@ -// 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 deleted file mode 100644 index 89d98d6d688..00000000000 --- a/src/test/rustdoc-ui/test-hidden.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -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 - |
