rustdoc: fix HTML validation failure by escaping data-ty

This commit is contained in:
Michael Howell 2022-11-11 07:35:09 -07:00
parent 53e8b490d8
commit 05824cd7b7

View File

@ -1312,10 +1312,10 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &mut Context<'_>) -> O
if has_notable_trait { if has_notable_trait {
cx.types_with_notable_traits.insert(ty.clone()); cx.types_with_notable_traits.insert(ty.clone());
Some(format!( Some(format!(
"<span class=\"notable-traits\" data-ty=\"{ty:#}\">\ "<span class=\"notable-traits\" data-ty=\"{ty}\">\
<span class=\"notable-traits-tooltip\">ⓘ</span>\ <span class=\"notable-traits-tooltip\">ⓘ</span>\
</span>", </span>",
ty = ty.print(cx), ty = Escape(&format!("{:#}", ty.print(cx))),
)) ))
} else { } else {
None None