@@ -1659,16 +1659,23 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1659
1659
. predicates
1660
1660
. iter ( )
1661
1661
. filter_map ( |predicate| {
1662
- let trait_ref = if let Some ( tr) = predicate. to_opt_poly_trait_ref ( ) {
1663
- tr
1664
- } else if let Some ( pred) = predicate. to_opt_type_outlives ( ) {
1665
- // these should turn up at the end
1666
- if let Some ( r) = pred. skip_binder ( ) . 1 . clean ( cx) {
1667
- regions. push ( GenericBound :: Outlives ( r) ) ;
1662
+ // Note: The substs of opaque types can contain unbound variables,
1663
+ // meaning that we have to use `ignore_qualifiers_with_unbound_vars` here.
1664
+ let trait_ref = match predicate
1665
+ . ignore_qualifiers_with_unbound_vars ( cx. tcx )
1666
+ . skip_binder ( )
1667
+ . kind ( )
1668
+ {
1669
+ ty:: PredicateKind :: Trait ( tr, _constness) => {
1670
+ ty:: Binder :: bind ( tr. trait_ref )
1671
+ }
1672
+ ty:: PredicateKind :: TypeOutlives ( pred) => {
1673
+ if let Some ( r) = pred. 1 . clean ( cx) {
1674
+ regions. push ( GenericBound :: Outlives ( r) ) ;
1675
+ }
1676
+ return None ;
1668
1677
}
1669
- return None ;
1670
- } else {
1671
- return None ;
1678
+ _ => return None ,
1672
1679
} ;
1673
1680
1674
1681
if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( ) {
@@ -1682,10 +1689,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1682
1689
. predicates
1683
1690
. iter ( )
1684
1691
. filter_map ( |pred| {
1685
- if let ty:: PredicateKind :: Projection ( proj) =
1686
- pred. ignore_qualifiers ( ) . skip_binder ( ) . kind ( )
1692
+ if let ty:: PredicateKind :: Projection ( proj) = pred
1693
+ . ignore_qualifiers_with_unbound_vars ( cx. tcx )
1694
+ . skip_binder ( )
1695
+ . kind ( )
1687
1696
{
1688
- let proj = proj;
1689
1697
if proj. projection_ty . trait_ref ( cx. tcx )
1690
1698
== * trait_ref. skip_binder ( )
1691
1699
{
0 commit comments