about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-20 07:10:33 +0100
committerGitHub <noreply@github.com>2023-03-20 07:10:33 +0100
commit39e09ac3341e1b96b4b36d80992b452257896cbf (patch)
tree66471a03d432bb36d44e029c434cdcb7f61ee428 /src
parentfb4f015ea35840983d2077d4d8ae2c3ed8f3ed7a (diff)
parent5a752cd2ca4378cf86831292fdf601636167554c (diff)
downloadrust-39e09ac3341e1b96b4b36d80992b452257896cbf.tar.gz
rust-39e09ac3341e1b96b4b36d80992b452257896cbf.zip
Rollup merge of #109351 - GuillaumeGomez:no-footnote-in-summary, r=notriddle
rustdoc: Remove footnote references from doc summary

Since it's one line, we don't have the footnote definition so it doesn't make sense to have the reference.

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

r? `@notriddle`
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/markdown.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index fe446ae3c16..fd81a21f5a9 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -556,7 +556,15 @@ fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
 }
 
 fn is_forbidden_tag(t: &Tag<'_>) -> bool {
-    matches!(t, Tag::CodeBlock(_) | Tag::Table(_) | Tag::TableHead | Tag::TableRow | Tag::TableCell)
+    matches!(
+        t,
+        Tag::CodeBlock(_)
+            | Tag::Table(_)
+            | Tag::TableHead
+            | Tag::TableRow
+            | Tag::TableCell
+            | Tag::FootnoteDefinition(_)
+    )
 }
 
 impl<'a, I: Iterator<Item = Event<'a>>> Iterator for SummaryLine<'a, I> {
@@ -589,6 +597,10 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for SummaryLine<'a, I> {
                     is_start = false;
                     check_if_allowed_tag(c)
                 }
+                Event::FootnoteReference(_) => {
+                    self.skipped_tags += 1;
+                    false
+                }
                 _ => true,
             };
             if !is_allowed_tag {