]> git.lizzy.rs Git - rust.git/commitdiff
Assert that `tag_name` is alphabetic
authorNoah Lev <camelidcamel@gmail.com>
Wed, 25 Aug 2021 20:49:51 +0000 (13:49 -0700)
committerNoah Lev <camelidcamel@gmail.com>
Thu, 26 Aug 2021 03:03:27 +0000 (20:03 -0700)
src/librustdoc/html/length_limit.rs

index ecf41f7afa7e361496430758ea9a1426c669c0b3..28a207a84ba6d300f46142ec6c41749f83c797ff 100644 (file)
@@ -72,7 +72,15 @@ pub(super) fn push(&mut self, text: &str) -> ControlFlow<(), ()> {
     }
 
     /// 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);
     }