Skip to content

Commit

Permalink
Assert that tag_name is alphabetic
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Aug 26, 2021
1 parent f8ca576 commit d932e62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustdoc/html/length_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d932e62

Please sign in to comment.