Skip to content

Commit 42816d6

Browse files
committed
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.
2 parents 7e11f3a + 5b05f68 commit 42816d6

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

Diff for: src/librustdoc/html/markdown.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,12 @@ fn map_line(s: &str) -> Line<'_> {
147147
let trimmed = s.trim();
148148
if trimmed.starts_with("##") {
149149
Line::Shown(Cow::Owned(s.replacen("##", "#", 1)))
150-
} else if trimmed.starts_with('#') {
151-
let mut without_hash = trimmed[1..].trim_start();
152-
if without_hash.starts_with('!') {
153-
// #! text
154-
without_hash = without_hash[1..].trim_start_matches(' ');
155-
}
156-
if without_hash.starts_with('[') {
157-
// #[attr] or #![attr]
158-
Line::Shown(Cow::Borrowed(s))
159-
} else {
160-
// #text
161-
Line::Hidden(without_hash)
162-
}
150+
} else if let Some(stripped) = trimmed.strip_prefix("# ") {
151+
// # text
152+
Line::Hidden(&stripped)
153+
} else if trimmed == "#" {
154+
// We cannot handle '#text' because it could be #[attr].
155+
Line::Hidden("")
163156
} else {
164157
Line::Shown(Cow::Borrowed(s))
165158
}

Diff for: src/test/rustdoc-ui/test-hidden.rs

-25
This file was deleted.

Diff for: src/test/rustdoc-ui/test-hidden.stdout

-6
This file was deleted.

0 commit comments

Comments
 (0)