From d932e62dd9a6137a831d0917aa80aefd7ff47018 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 25 Aug 2021 13:49:51 -0700 Subject: [PATCH] Assert that `tag_name` is alphabetic --- src/librustdoc/html/length_limit.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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 @@ 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); } -- 2.44.0