rustdoc: handle assoc const equalities in cross-crate impl-Trait-in-arg-pos
This commit is contained in:
parent
e0ba2d038d
commit
247aa06f10
@ -791,10 +791,10 @@ fn clean_ty_generics<'tcx>(
|
|||||||
})
|
})
|
||||||
.collect::<ThinVec<GenericParamDef>>();
|
.collect::<ThinVec<GenericParamDef>>();
|
||||||
|
|
||||||
// param index -> [(trait DefId, associated type name & generics, type, higher-ranked params)]
|
// param index -> [(trait DefId, associated type name & generics, term, higher-ranked params)]
|
||||||
let mut impl_trait_proj = FxHashMap::<
|
let mut impl_trait_proj = FxHashMap::<
|
||||||
u32,
|
u32,
|
||||||
Vec<(DefId, PathSegment, ty::Binder<'_, Ty<'_>>, Vec<GenericParamDef>)>,
|
Vec<(DefId, PathSegment, ty::Binder<'_, ty::Term<'_>>, Vec<GenericParamDef>)>,
|
||||||
>::default();
|
>::default();
|
||||||
|
|
||||||
let where_predicates = preds
|
let where_predicates = preds
|
||||||
@ -852,11 +852,10 @@ fn clean_ty_generics<'tcx>(
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|(lhs, rhs): &(Type, _)| Some((lhs.projection()?, rhs)))
|
.and_then(|(lhs, rhs): &(Type, _)| Some((lhs.projection()?, rhs)))
|
||||||
{
|
{
|
||||||
// FIXME(...): Remove this unwrap()
|
|
||||||
impl_trait_proj.entry(param_idx).or_default().push((
|
impl_trait_proj.entry(param_idx).or_default().push((
|
||||||
trait_did,
|
trait_did,
|
||||||
name,
|
name,
|
||||||
rhs.map_bound(|rhs| rhs.ty().unwrap()),
|
*rhs,
|
||||||
p.get_bound_params()
|
p.get_bound_params()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
@ -879,15 +878,8 @@ fn clean_ty_generics<'tcx>(
|
|||||||
let crate::core::ImplTraitParam::ParamIndex(idx) = param else { unreachable!() };
|
let crate::core::ImplTraitParam::ParamIndex(idx) = param else { unreachable!() };
|
||||||
if let Some(proj) = impl_trait_proj.remove(&idx) {
|
if let Some(proj) = impl_trait_proj.remove(&idx) {
|
||||||
for (trait_did, name, rhs, bound_params) in proj {
|
for (trait_did, name, rhs, bound_params) in proj {
|
||||||
let rhs = clean_middle_ty(rhs, cx, None, None);
|
let rhs = clean_middle_term(rhs, cx);
|
||||||
simplify::merge_bounds(
|
simplify::merge_bounds(cx, &mut bounds, bound_params, trait_did, name, &rhs);
|
||||||
cx,
|
|
||||||
&mut bounds,
|
|
||||||
bound_params,
|
|
||||||
trait_did,
|
|
||||||
name,
|
|
||||||
&Term::Type(rhs),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
tests/rustdoc/inline_cross/assoc-const-equality.rs
Normal file
8
tests/rustdoc/inline_cross/assoc-const-equality.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// aux-crate:assoc_const_equality=assoc-const-equality.rs
|
||||||
|
// edition:2021
|
||||||
|
|
||||||
|
#![crate_name = "user"]
|
||||||
|
|
||||||
|
// @has user/fn.accept.html
|
||||||
|
// @has - '//pre[@class="rust item-decl"]' 'fn accept(_: impl Trait<K = 0>)'
|
||||||
|
pub use assoc_const_equality::accept;
|
@ -0,0 +1,7 @@
|
|||||||
|
#![feature(associated_const_equality)]
|
||||||
|
|
||||||
|
pub fn accept(_: impl Trait<K = 0>) {}
|
||||||
|
|
||||||
|
pub trait Trait {
|
||||||
|
const K: i32;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user