Skip to content

Commit

Permalink
Fix invalid ID value in all.html file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 5, 2021
1 parent 8c9200d commit e078e56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,13 @@ impl AllTypes {
if !e.is_empty() {
let mut e: Vec<&ItemEntry> = e.iter().collect();
e.sort();
write!(f, "<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">", title, title, class);
write!(
f,
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">",
title.replace(' ', "-"), // IDs cannot contain whitespaces.
title,
class
);

for s in e.iter() {
write!(f, "<li>{}</li>", s.print());
Expand All @@ -346,7 +352,7 @@ impl AllTypes {
</h1>",
);
// Note: print_entries does not escape the title, because we know the current set of titles
// don't require escaping.
// doesn't require escaping.
print_entries(f, &self.structs, "Structs", "structs");
print_entries(f, &self.enums, "Enums", "enums");
print_entries(f, &self.unions, "Unions", "unions");
Expand Down

0 comments on commit e078e56

Please sign in to comment.