@@ -1643,6 +1643,15 @@ impl From<ast::UintTy> for PrimitiveType {
1643
1643
}
1644
1644
}
1645
1645
1646
+ impl From < ast:: FloatTy > for PrimitiveType {
1647
+ fn from ( float_ty : ast:: FloatTy ) -> PrimitiveType {
1648
+ match float_ty {
1649
+ ast:: FloatTy :: F32 => PrimitiveType :: F32 ,
1650
+ ast:: FloatTy :: F64 => PrimitiveType :: F64 ,
1651
+ }
1652
+ }
1653
+ }
1654
+
1646
1655
// Poor man's type parameter substitution at HIR level.
1647
1656
// Used to replace private type aliases in public signatures with their aliased types.
1648
1657
struct SubstAlias < ' a , ' tcx : ' a > {
@@ -1797,8 +1806,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1797
1806
ty:: TyChar => Primitive ( PrimitiveType :: Char ) ,
1798
1807
ty:: TyInt ( int_ty) => Primitive ( int_ty. into ( ) ) ,
1799
1808
ty:: TyUint ( uint_ty) => Primitive ( uint_ty. into ( ) ) ,
1800
- ty:: TyFloat ( ast:: FloatTy :: F32 ) => Primitive ( PrimitiveType :: F32 ) ,
1801
- ty:: TyFloat ( ast:: FloatTy :: F64 ) => Primitive ( PrimitiveType :: F64 ) ,
1809
+ ty:: TyFloat ( float_ty) => Primitive ( float_ty. into ( ) ) ,
1802
1810
ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
1803
1811
ty:: TyBox ( t) => {
1804
1812
let box_did = cx. tcx_opt ( ) . and_then ( |tcx| {
@@ -2758,8 +2766,7 @@ fn resolve_type(cx: &DocContext,
2758
2766
hir:: TyChar => return Primitive ( PrimitiveType :: Char ) ,
2759
2767
hir:: TyInt ( int_ty) => return Primitive ( int_ty. into ( ) ) ,
2760
2768
hir:: TyUint ( uint_ty) => return Primitive ( uint_ty. into ( ) ) ,
2761
- hir:: TyFloat ( ast:: FloatTy :: F32 ) => return Primitive ( PrimitiveType :: F32 ) ,
2762
- hir:: TyFloat ( ast:: FloatTy :: F64 ) => return Primitive ( PrimitiveType :: F64 ) ,
2769
+ hir:: TyFloat ( float_ty) => return Primitive ( float_ty. into ( ) ) ,
2763
2770
} ,
2764
2771
Def :: SelfTy ( ..) if path. segments . len ( ) == 1 => {
2765
2772
return Generic ( keywords:: SelfType . name ( ) . to_string ( ) ) ;
0 commit comments