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/clean/auto_trait.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/librustdoc/clean/auto_trait.rs') diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 175472797..764a6d3aa 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -148,7 +148,7 @@ where }) .collect(); // We are only interested in case the type *doesn't* implement the Sized trait. - if !ty.is_sized(tcx.at(rustc_span::DUMMY_SP), param_env) { + if !ty.is_sized(tcx, param_env) { // In case `#![no_core]` is used, `sized_trait` returns nothing. if let Some(item) = tcx.lang_items().sized_trait().and_then(|sized_trait_did| { self.generate_for_trait(ty, sized_trait_did, param_env, item_def_id, &f, true) @@ -475,6 +475,12 @@ where let mut ty_to_fn: FxHashMap)> = Default::default(); + // FIXME: This code shares much of the logic found in `clean_ty_generics` and + // `simplify::where_clause`. Consider deduplicating it to avoid diverging + // implementations. + // Further, the code below does not merge (partially re-sugared) bounds like + // `Tr` & `Tr` and it does not render higher-ranked parameters + // originating from equality predicates. for p in clean_where_predicates { let (orig_p, p) = (p, clean_predicate(p, self.cx)); if p.is_none() { @@ -549,8 +555,8 @@ where WherePredicate::RegionPredicate { lifetime, bounds } => { lifetime_to_bounds.entry(lifetime).or_default().extend(bounds); } - WherePredicate::EqPredicate { lhs, rhs } => { - match lhs { + WherePredicate::EqPredicate { lhs, rhs, bound_params } => { + match *lhs { Type::QPath(box QPathData { ref assoc, ref self_type, ref trait_, .. }) => { @@ -585,13 +591,14 @@ where GenericArgs::AngleBracketed { ref mut bindings, .. } => { bindings.push(TypeBinding { assoc: assoc.clone(), - kind: TypeBindingKind::Equality { term: rhs }, + kind: TypeBindingKind::Equality { term: *rhs }, }); } GenericArgs::Parenthesized { .. } => { existing_predicates.push(WherePredicate::EqPredicate { lhs: lhs.clone(), rhs, + bound_params, }); continue; // If something other than a Fn ends up // with parentheses, leave it alone -- cgit v1.2.3