From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/librustdoc/html/format.rs | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/librustdoc/html/format.rs') diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index b499e186c..92e7f2739 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -331,7 +331,8 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>( bounds_display.truncate(bounds_display.len() - " + ".len()); write!(f, "{}: {bounds_display}", lifetime.print()) } - clean::WherePredicate::EqPredicate { lhs, rhs } => { + // FIXME(fmease): Render bound params. + clean::WherePredicate::EqPredicate { lhs, rhs, bound_params: _ } => { if f.alternate() { write!(f, "{:#} == {:#}", lhs.print(cx), rhs.print(cx)) } else { @@ -611,7 +612,7 @@ fn generate_macro_def_id_path( }; if path.len() < 2 { // The minimum we can have is the crate name followed by the macro name. If shorter, then - // it means that that `relative` was empty, which is an error. + // it means that `relative` was empty, which is an error. debug!("macro path cannot be empty!"); return Err(HrefError::NotInExternalCache); } @@ -658,7 +659,7 @@ pub(crate) fn href_with_root_path( } if !did.is_local() - && !cache.access_levels.is_public(did) + && !cache.effective_visibilities.is_directly_public(did) && !cache.document_private && !cache.primitive_locations.values().any(|&id| id == did) { @@ -1010,15 +1011,25 @@ fn fmt_type<'cx>( write!(f, "]") } }, - clean::Array(ref t, ref n) => { - primitive_link(f, PrimitiveType::Array, "[", cx)?; - fmt::Display::fmt(&t.print(cx), f)?; - if f.alternate() { - primitive_link(f, PrimitiveType::Array, &format!("; {}]", n), cx) - } else { - primitive_link(f, PrimitiveType::Array, &format!("; {}]", Escape(n)), cx) + clean::Array(ref t, ref n) => match **t { + clean::Generic(name) if !f.alternate() => primitive_link( + f, + PrimitiveType::Array, + &format!("[{name}; {n}]", n = Escape(n)), + cx, + ), + _ => { + write!(f, "[")?; + fmt::Display::fmt(&t.print(cx), f)?; + if f.alternate() { + write!(f, "; {n}")?; + } else { + write!(f, "; ")?; + primitive_link(f, PrimitiveType::Array, &format!("{n}", n = Escape(n)), cx)?; + } + write!(f, "]") } - } + }, clean::RawPointer(m, ref t) => { let m = match m { hir::Mutability::Mut => "mut", -- cgit v1.2.3