Skip to content

Commit e078e56

Browse files
Fix invalid ID value in all.html file
1 parent 8c9200d commit e078e56

File tree

1 file changed

+8
-2
lines changed
  • src/librustdoc/html/render

1 file changed

+8
-2
lines changed

src/librustdoc/html/render/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,13 @@ impl AllTypes {
322322
if !e.is_empty() {
323323
let mut e: Vec<&ItemEntry> = e.iter().collect();
324324
e.sort();
325-
write!(f, "<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">", title, title, class);
325+
write!(
326+
f,
327+
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">",
328+
title.replace(' ', "-"), // IDs cannot contain whitespaces.
329+
title,
330+
class
331+
);
326332

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

0 commit comments

Comments
 (0)