1
Fork 0

Rollup merge of #67908 - ollie27:rustdoc_const_html_escape, r=GuillaumeGomez

rustdoc: HTML escape const values

r? @GuillaumeGomez
This commit is contained in:
Yuki Okushi 2020-01-07 13:46:07 +09:00 committed by GitHub
commit c07204b1d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 5 deletions

View file

@ -2280,7 +2280,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
);
if c.value.is_some() || c.is_literal {
write!(w, " = {expr};", expr = c.expr);
write!(w, " = {expr};", expr = Escape(&c.expr));
} else {
write!(w, ";");
}
@ -2293,7 +2293,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
if value_lowercase != expr_lowercase
&& value_lowercase.trim_end_matches("i32") != expr_lowercase
{
write!(w, " // {value}", value = value);
write!(w, " // {value}", value = Escape(value));
}
}
}