@@ -22,6 +22,7 @@ use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
2222use rustc_middle:: middle:: resolve_lifetime as rl;
2323use rustc_middle:: ty:: fold:: TypeFolder ;
2424use rustc_middle:: ty:: InternalSubsts ;
25+ use rustc_middle:: ty:: TypeVisitable ;
2526use rustc_middle:: ty:: { self , AdtKind , DefIdTree , EarlyBinder , Ty , TyCtxt } ;
2627use rustc_middle:: { bug, span_bug} ;
2728use rustc_span:: hygiene:: { AstPass , MacroKind } ;
@@ -1459,8 +1460,11 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
14591460 hir:: QPath :: Resolved ( Some ( qself) , p) => {
14601461 // Try to normalize `<X as Y>::T` to a type
14611462 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+ }
14641468 }
14651469
14661470 let trait_segments = & p. segments [ ..p. segments . len ( ) - 1 ] ;
0 commit comments