@@ -22,6 +22,7 @@ use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
22
22
use rustc_middle:: middle:: resolve_lifetime as rl;
23
23
use rustc_middle:: ty:: fold:: TypeFolder ;
24
24
use rustc_middle:: ty:: InternalSubsts ;
25
+ use rustc_middle:: ty:: TypeVisitable ;
25
26
use rustc_middle:: ty:: { self , AdtKind , DefIdTree , EarlyBinder , Ty , TyCtxt } ;
26
27
use rustc_middle:: { bug, span_bug} ;
27
28
use rustc_span:: hygiene:: { AstPass , MacroKind } ;
@@ -1459,8 +1460,11 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1459
1460
hir:: QPath :: Resolved ( Some ( qself) , p) => {
1460
1461
// Try to normalize `<X as Y>::T` to a type
1461
1462
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1462
- if let Some ( normalized_value) = normalize ( cx, ty:: Binder :: dummy ( ty) ) {
1463
- return clean_middle_ty ( normalized_value, cx, None ) ;
1463
+ // `hir_to_ty` can return projection types with escaping vars for GATs, e.g. `<() as Trait>::Gat<'_>`
1464
+ if !ty. has_escaping_bound_vars ( ) {
1465
+ if let Some ( normalized_value) = normalize ( cx, ty:: Binder :: dummy ( ty) ) {
1466
+ return clean_middle_ty ( normalized_value, cx, None ) ;
1467
+ }
1464
1468
}
1465
1469
1466
1470
let trait_segments = & p. segments [ ..p. segments . len ( ) - 1 ] ;
0 commit comments