about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-08-25 13:49:51 -0700
committerNoah Lev <camelidcamel@gmail.com>2021-08-25 20:03:27 -0700
commitd932e62dd9a6137a831d0917aa80aefd7ff47018 (patch)
tree731b2223005db9135f69ccfc88643f91b563e063
parentf8ca5764c36feab162893cd16b567d87edd4cf8e (diff)
Assert that `tag_name` is alphabetic
-rw-r--r--src/librustdoc/html/length_limit.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustdoc/html/length_limit.rs b/src/librustdoc/html/length_limit.rs
index ecf41f7afa7..28a207a84ba 100644
--- a/src/librustdoc/html/length_limit.rs
+++ b/src/librustdoc/html/length_limit.rs
@@ -72,7 +72,15 @@ impl HtmlWithLimit {
     }
 
     /// Open an HTML tag.
+    ///
+    /// **Note:** HTML attributes have not yet been implemented.
+    /// This function will panic if called with a non-alphabetic `tag_name`.
     pub(super) fn open_tag(&mut self, tag_name: &'static str) {
+        assert!(
+            tag_name.chars().all(|c| ('a'..='z').contains(&c)),
+            "tag_name contained non-alphabetic chars: {:?}",
+            tag_name
+        );
         self.queued_tags.push(tag_name);
     }