Skip to content

Commit 562d478

Browse files
committed
fix rustdoc
1 parent 1151d62 commit 562d478

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,16 +1661,23 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16611661
.predicates
16621662
.iter()
16631663
.filter_map(|predicate| {
1664-
let trait_ref = if let Some(tr) = predicate.to_opt_poly_trait_ref() {
1665-
tr
1666-
} else if let Some(pred) = predicate.to_opt_type_outlives() {
1667-
// these should turn up at the end
1668-
if let Some(r) = pred.skip_binder().1.clean(cx) {
1669-
regions.push(GenericBound::Outlives(r));
1664+
// Note: The substs of opaque types can contain unbound variables,
1665+
// meaning that we have to use `ignore_qualifiers_with_unbound_vars` here.
1666+
let trait_ref = match predicate
1667+
.ignore_qualifiers_with_unbound_vars(cx.tcx)
1668+
.skip_binder()
1669+
.kind()
1670+
{
1671+
ty::PredicateKind::Trait(tr, _constness) => {
1672+
ty::Binder::bind(tr.trait_ref)
1673+
}
1674+
ty::PredicateKind::TypeOutlives(pred) => {
1675+
if let Some(r) = pred.1.clean(cx) {
1676+
regions.push(GenericBound::Outlives(r));
1677+
}
1678+
return None;
16701679
}
1671-
return None;
1672-
} else {
1673-
return None;
1680+
_ => return None,
16741681
};
16751682

16761683
if let Some(sized) = cx.tcx.lang_items().sized_trait() {
@@ -1684,10 +1691,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16841691
.predicates
16851692
.iter()
16861693
.filter_map(|pred| {
1687-
if let ty::PredicateKind::Projection(proj) =
1688-
pred.ignore_qualifiers().skip_binder().kind()
1694+
if let ty::PredicateKind::Projection(proj) = pred
1695+
.ignore_qualifiers_with_unbound_vars(cx.tcx)
1696+
.skip_binder()
1697+
.kind()
16891698
{
1690-
let proj = proj;
16911699
if proj.projection_ty.trait_ref(cx.tcx)
16921700
== trait_ref.skip_binder()
16931701
{

0 commit comments

Comments
 (0)