Closed
Description
For following sample crate named docfail
html doc for sidebar doesn't escape angled brackets (<
, >
) for generic type as target.
// src/lib.rs
use std::ops::{Deref, DerefMut};
/// Title
#[derive(Debug, Clone)]
pub struct Title {
name: String,
}
/// Title Collection
#[derive(Debug, Clone)]
pub struct TitleList {
pub members: Vec<Title>,
}
impl TitleList {
// Constructor
pub fn new() -> Self {
TitleList { members: Vec::new() }
}
}
impl Deref for TitleList {
type Target = Vec<Title>;
fn deref(&self) -> &Self::Target {
&self.members
}
}
impl DerefMut for TitleList {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.members
}
}
Following is rustdoc generates html compared with expected html (diff -u target/doc/docfail/struct.TitleList.html target/doc/docfail/expected_struct.TitleList.html
). Notice changes in 32nd line 200th column.
--- target/doc/docfail/struct.TitleList.html 2017-12-14 13:01:13.000000000 +0530
+++ target/doc/docfail/expected_struct.TitleList.html 2017-12-14 12:28:43.000000000 +0530
@@ -29,7 +29,7 @@
<nav class="sidebar">
- <p class='location'>Struct TitleList</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#deref-methods">Methods from Deref<Target=Vec<Title>></a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='index.html'>docfail</a></p><script>window.sidebarCurrent = {name: 'TitleList', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
+ <p class='location'>Struct TitleList</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#deref-methods">Methods from Deref<Target=Vec<Title>></a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='index.html'>docfail</a></p><script>window.sidebarCurrent = {name: 'TitleList', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
In my case, as the generic struct is coincidently named Title
the corresponding html (<Title>
) throws browser bonkers and nothing but sidebar is visible.
Rustdoc version used: rustdoc 1.22.1 (05e2e1c41 2017-11-22)