@@ -1770,7 +1770,7 @@ fn maybe_expand_private_type_alias<'tcx>(
1770
1770
}
1771
1771
indices. lifetimes += 1 ;
1772
1772
}
1773
- hir:: GenericParamKind :: Type { ref default, .. } => {
1773
+ hir:: GenericParamKind :: Type { default, .. } => {
1774
1774
let mut j = 0 ;
1775
1775
let type_ = generic_args. args . iter ( ) . find_map ( |arg| match arg {
1776
1776
hir:: GenericArg :: Type ( ty) => {
@@ -1782,8 +1782,11 @@ fn maybe_expand_private_type_alias<'tcx>(
1782
1782
}
1783
1783
_ => None ,
1784
1784
} ) ;
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
+ ) ;
1787
1790
}
1788
1791
indices. types += 1 ;
1789
1792
}
@@ -1839,16 +1842,19 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
1839
1842
TyKind :: Path ( _) => clean_qpath ( ty, cx) ,
1840
1843
TyKind :: TraitObject ( bounds, lifetime) => {
1841
1844
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
+ } ;
1844
1850
DynTrait ( bounds, lifetime)
1845
1851
}
1846
1852
TyKind :: BareFn ( barefn) => BareFunction ( Box :: new ( clean_bare_fn_ty ( barefn, cx) ) ) ,
1847
1853
TyKind :: UnsafeBinder ( unsafe_binder_ty) => {
1848
1854
UnsafeBinder ( Box :: new ( clean_unsafe_binder_ty ( unsafe_binder_ty, cx) ) )
1849
1855
}
1850
1856
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1851
- TyKind :: Infer
1857
+ TyKind :: Infer ( _ )
1852
1858
| TyKind :: Err ( _)
1853
1859
| TyKind :: Typeof ( ..)
1854
1860
| TyKind :: InferDelegation ( ..)
@@ -2527,8 +2533,10 @@ fn clean_generic_args<'tcx>(
2527
2533
GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
2528
2534
}
2529
2535
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
+ }
2532
2540
hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2533
2541
} )
2534
2542
. collect :: < Vec < _ > > ( )
0 commit comments