@@ -1770,7 +1770,7 @@ fn maybe_expand_private_type_alias<'tcx>(
17701770 }
17711771 indices. lifetimes += 1 ;
17721772 }
1773- hir:: GenericParamKind :: Type { ref default, .. } => {
1773+ hir:: GenericParamKind :: Type { default, .. } => {
17741774 let mut j = 0 ;
17751775 let type_ = generic_args. args . iter ( ) . find_map ( |arg| match arg {
17761776 hir:: GenericArg :: Type ( ty) => {
@@ -1782,8 +1782,11 @@ fn maybe_expand_private_type_alias<'tcx>(
17821782 }
17831783 _ => None ,
17841784 } ) ;
1785- if let Some ( ty) = type_. or ( * default) {
1786- args. insert ( param. def_id . to_def_id ( ) , GenericArg :: Type ( clean_ty ( ty, cx) ) ) ;
1785+ if let Some ( ty) = type_. or ( default. map ( |d| d. as_ambig_ty ( ) ) ) {
1786+ args. insert (
1787+ param. def_id . to_def_id ( ) ,
1788+ GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
1789+ ) ;
17871790 }
17881791 indices. types += 1 ;
17891792 }
@@ -1839,16 +1842,19 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
18391842 TyKind :: Path ( _) => clean_qpath ( ty, cx) ,
18401843 TyKind :: TraitObject ( bounds, lifetime) => {
18411844 let bounds = bounds. iter ( ) . map ( |bound| clean_poly_trait_ref ( bound, cx) ) . collect ( ) ;
1842- let lifetime =
1843- if !lifetime. is_elided ( ) { Some ( clean_lifetime ( lifetime. pointer ( ) , cx) ) } else { None } ;
1845+ let lifetime = if !lifetime. is_elided ( ) {
1846+ Some ( clean_lifetime ( lifetime. pointer ( ) , cx) )
1847+ } else {
1848+ None
1849+ } ;
18441850 DynTrait ( bounds, lifetime)
18451851 }
18461852 TyKind :: BareFn ( barefn) => BareFunction ( Box :: new ( clean_bare_fn_ty ( barefn, cx) ) ) ,
18471853 TyKind :: UnsafeBinder ( unsafe_binder_ty) => {
18481854 UnsafeBinder ( Box :: new ( clean_unsafe_binder_ty ( unsafe_binder_ty, cx) ) )
18491855 }
18501856 // Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1851- TyKind :: Infer
1857+ TyKind :: Infer ( _ )
18521858 | TyKind :: Err ( _)
18531859 | TyKind :: Typeof ( ..)
18541860 | TyKind :: InferDelegation ( ..)
@@ -2527,8 +2533,10 @@ fn clean_generic_args<'tcx>(
25272533 GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
25282534 }
25292535 hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2530- hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty, cx) ) ,
2531- hir:: GenericArg :: Const ( ct) => GenericArg :: Const ( Box :: new ( clean_const ( ct, cx) ) ) ,
2536+ hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
2537+ hir:: GenericArg :: Const ( ct) => {
2538+ GenericArg :: Const ( Box :: new ( clean_const ( ct. as_unambig_ct ( ) , cx) ) )
2539+ }
25322540 hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
25332541 } )
25342542 . collect :: < Vec < _ > > ( )
0 commit comments