1
Fork 0

rustdoc: Render for<'_> lifetimes in front of where bound

This commit is contained in:
Justus K 2021-05-02 14:48:28 +02:00
parent 312b894cc1
commit e0162a8a56
No known key found for this signature in database
GPG key ID: 8C62FE98A62FC462
8 changed files with 104 additions and 22 deletions

View file

@ -249,17 +249,33 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
}
match pred {
clean::WherePredicate::BoundPredicate { ty, bounds } => {
clean::WherePredicate::BoundPredicate { ty, bounds, bound_params } => {
let bounds = bounds;
let for_prefix = match bound_params.len() {
0 => String::new(),
_ if f.alternate() => {
format!(
"for<{:#}> ",
comma_sep(bound_params.iter().map(|lt| lt.print()))
)
}
_ => format!(
"for&lt;{}&gt; ",
comma_sep(bound_params.iter().map(|lt| lt.print()))
),
};
if f.alternate() {
clause.push_str(&format!(
"{:#}: {:#}",
"{}{:#}: {:#}",
for_prefix,
ty.print(cx),
print_generic_bounds(bounds, cx)
));
} else {
clause.push_str(&format!(
"{}: {}",
"{}{}: {}",
for_prefix,
ty.print(cx),
print_generic_bounds(bounds, cx)
));