12
12
//! that clean them.
13
13
14
14
pub use self :: Type :: * ;
15
- pub use self :: PrimitiveType :: * ;
16
15
pub use self :: TypeKind :: * ;
17
16
pub use self :: VariantKind :: * ;
18
17
pub use self :: Mutability :: * ;
@@ -1517,12 +1516,12 @@ impl Type {
1517
1516
pub fn primitive_type ( & self ) -> Option < PrimitiveType > {
1518
1517
match * self {
1519
1518
Primitive ( p) | BorrowedRef { type_ : box Primitive ( p) , ..} => Some ( p) ,
1520
- Vector ( ..) | BorrowedRef { type_ : box Vector ( ..) , .. } => Some ( Slice ) ,
1519
+ Vector ( ..) | BorrowedRef { type_ : box Vector ( ..) , .. } => Some ( PrimitiveType :: Slice ) ,
1521
1520
FixedVector ( ..) | BorrowedRef { type_ : box FixedVector ( ..) , .. } => {
1522
- Some ( Array )
1521
+ Some ( PrimitiveType :: Array )
1523
1522
}
1524
- Tuple ( ..) => Some ( PrimitiveTuple ) ,
1525
- RawPointer ( ..) => Some ( PrimitiveRawPointer ) ,
1523
+ Tuple ( ..) => Some ( PrimitiveType :: PrimitiveTuple ) ,
1524
+ RawPointer ( ..) => Some ( PrimitiveType :: PrimitiveRawPointer ) ,
1526
1525
_ => None ,
1527
1526
}
1528
1527
}
@@ -1547,25 +1546,25 @@ impl GetDefId for Type {
1547
1546
impl PrimitiveType {
1548
1547
fn from_str ( s : & str ) -> Option < PrimitiveType > {
1549
1548
match s {
1550
- "isize" => Some ( Isize ) ,
1551
- "i8" => Some ( I8 ) ,
1552
- "i16" => Some ( I16 ) ,
1553
- "i32" => Some ( I32 ) ,
1554
- "i64" => Some ( I64 ) ,
1555
- "usize" => Some ( Usize ) ,
1556
- "u8" => Some ( U8 ) ,
1557
- "u16" => Some ( U16 ) ,
1558
- "u32" => Some ( U32 ) ,
1559
- "u64" => Some ( U64 ) ,
1560
- "bool" => Some ( Bool ) ,
1561
- "char" => Some ( Char ) ,
1562
- "str" => Some ( Str ) ,
1563
- "f32" => Some ( F32 ) ,
1564
- "f64" => Some ( F64 ) ,
1565
- "array" => Some ( Array ) ,
1566
- "slice" => Some ( Slice ) ,
1567
- "tuple" => Some ( PrimitiveTuple ) ,
1568
- "pointer" => Some ( PrimitiveRawPointer ) ,
1549
+ "isize" => Some ( PrimitiveType :: Isize ) ,
1550
+ "i8" => Some ( PrimitiveType :: I8 ) ,
1551
+ "i16" => Some ( PrimitiveType :: I16 ) ,
1552
+ "i32" => Some ( PrimitiveType :: I32 ) ,
1553
+ "i64" => Some ( PrimitiveType :: I64 ) ,
1554
+ "usize" => Some ( PrimitiveType :: Usize ) ,
1555
+ "u8" => Some ( PrimitiveType :: U8 ) ,
1556
+ "u16" => Some ( PrimitiveType :: U16 ) ,
1557
+ "u32" => Some ( PrimitiveType :: U32 ) ,
1558
+ "u64" => Some ( PrimitiveType :: U64 ) ,
1559
+ "bool" => Some ( PrimitiveType :: Bool ) ,
1560
+ "char" => Some ( PrimitiveType :: Char ) ,
1561
+ "str" => Some ( PrimitiveType :: Str ) ,
1562
+ "f32" => Some ( PrimitiveType :: F32 ) ,
1563
+ "f64" => Some ( PrimitiveType :: F64 ) ,
1564
+ "array" => Some ( PrimitiveType :: Array ) ,
1565
+ "slice" => Some ( PrimitiveType :: Slice ) ,
1566
+ "tuple" => Some ( PrimitiveType :: PrimitiveTuple ) ,
1567
+ "pointer" => Some ( PrimitiveType :: PrimitiveRawPointer ) ,
1569
1568
_ => None ,
1570
1569
}
1571
1570
}
@@ -1585,25 +1584,25 @@ impl PrimitiveType {
1585
1584
1586
1585
pub fn to_string ( & self ) -> & ' static str {
1587
1586
match * self {
1588
- Isize => "isize" ,
1589
- I8 => "i8" ,
1590
- I16 => "i16" ,
1591
- I32 => "i32" ,
1592
- I64 => "i64" ,
1593
- Usize => "usize" ,
1594
- U8 => "u8" ,
1595
- U16 => "u16" ,
1596
- U32 => "u32" ,
1597
- U64 => "u64" ,
1598
- F32 => "f32" ,
1599
- F64 => "f64" ,
1600
- Str => "str" ,
1601
- Bool => "bool" ,
1602
- Char => "char" ,
1603
- Array => "array" ,
1604
- Slice => "slice" ,
1605
- PrimitiveTuple => "tuple" ,
1606
- PrimitiveRawPointer => "pointer" ,
1587
+ PrimitiveType :: Isize => "isize" ,
1588
+ PrimitiveType :: I8 => "i8" ,
1589
+ PrimitiveType :: I16 => "i16" ,
1590
+ PrimitiveType :: I32 => "i32" ,
1591
+ PrimitiveType :: I64 => "i64" ,
1592
+ PrimitiveType :: Usize => "usize" ,
1593
+ PrimitiveType :: U8 => "u8" ,
1594
+ PrimitiveType :: U16 => "u16" ,
1595
+ PrimitiveType :: U32 => "u32" ,
1596
+ PrimitiveType :: U64 => "u64" ,
1597
+ PrimitiveType :: F32 => "f32" ,
1598
+ PrimitiveType :: F64 => "f64" ,
1599
+ PrimitiveType :: Str => "str" ,
1600
+ PrimitiveType :: Bool => "bool" ,
1601
+ PrimitiveType :: Char => "char" ,
1602
+ PrimitiveType :: Array => "array" ,
1603
+ PrimitiveType :: Slice => "slice" ,
1604
+ PrimitiveType :: PrimitiveTuple => "tuple" ,
1605
+ PrimitiveType :: PrimitiveRawPointer => "pointer" ,
1607
1606
}
1608
1607
}
1609
1608
@@ -1771,21 +1770,21 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1771
1770
fn clean ( & self , cx : & DocContext ) -> Type {
1772
1771
match self . sty {
1773
1772
ty:: TyNever => Never ,
1774
- ty:: TyBool => Primitive ( Bool ) ,
1775
- ty:: TyChar => Primitive ( Char ) ,
1776
- ty:: TyInt ( ast:: IntTy :: Is ) => Primitive ( Isize ) ,
1777
- ty:: TyInt ( ast:: IntTy :: I8 ) => Primitive ( I8 ) ,
1778
- ty:: TyInt ( ast:: IntTy :: I16 ) => Primitive ( I16 ) ,
1779
- ty:: TyInt ( ast:: IntTy :: I32 ) => Primitive ( I32 ) ,
1780
- ty:: TyInt ( ast:: IntTy :: I64 ) => Primitive ( I64 ) ,
1781
- ty:: TyUint ( ast:: UintTy :: Us ) => Primitive ( Usize ) ,
1782
- ty:: TyUint ( ast:: UintTy :: U8 ) => Primitive ( U8 ) ,
1783
- ty:: TyUint ( ast:: UintTy :: U16 ) => Primitive ( U16 ) ,
1784
- ty:: TyUint ( ast:: UintTy :: U32 ) => Primitive ( U32 ) ,
1785
- ty:: TyUint ( ast:: UintTy :: U64 ) => Primitive ( U64 ) ,
1786
- ty:: TyFloat ( ast:: FloatTy :: F32 ) => Primitive ( F32 ) ,
1787
- ty:: TyFloat ( ast:: FloatTy :: F64 ) => Primitive ( F64 ) ,
1788
- ty:: TyStr => Primitive ( Str ) ,
1773
+ ty:: TyBool => Primitive ( PrimitiveType :: Bool ) ,
1774
+ ty:: TyChar => Primitive ( PrimitiveType :: Char ) ,
1775
+ ty:: TyInt ( ast:: IntTy :: Is ) => Primitive ( PrimitiveType :: Isize ) ,
1776
+ ty:: TyInt ( ast:: IntTy :: I8 ) => Primitive ( PrimitiveType :: I8 ) ,
1777
+ ty:: TyInt ( ast:: IntTy :: I16 ) => Primitive ( PrimitiveType :: I16 ) ,
1778
+ ty:: TyInt ( ast:: IntTy :: I32 ) => Primitive ( PrimitiveType :: I32 ) ,
1779
+ ty:: TyInt ( ast:: IntTy :: I64 ) => Primitive ( PrimitiveType :: I64 ) ,
1780
+ ty:: TyUint ( ast:: UintTy :: Us ) => Primitive ( PrimitiveType :: Usize ) ,
1781
+ ty:: TyUint ( ast:: UintTy :: U8 ) => Primitive ( PrimitiveType :: U8 ) ,
1782
+ ty:: TyUint ( ast:: UintTy :: U16 ) => Primitive ( PrimitiveType :: U16 ) ,
1783
+ ty:: TyUint ( ast:: UintTy :: U32 ) => Primitive ( PrimitiveType :: U32 ) ,
1784
+ ty:: TyUint ( ast:: UintTy :: U64 ) => Primitive ( PrimitiveType :: U64 ) ,
1785
+ ty:: TyFloat ( ast:: FloatTy :: F32 ) => Primitive ( PrimitiveType :: F32 ) ,
1786
+ ty:: TyFloat ( ast:: FloatTy :: F64 ) => Primitive ( PrimitiveType :: F64 ) ,
1787
+ ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
1789
1788
ty:: TyBox ( t) => {
1790
1789
let box_did = cx. tcx_opt ( ) . and_then ( |tcx| {
1791
1790
tcx. lang_items . owned_box ( )
@@ -2438,25 +2437,25 @@ fn build_deref_target_impls(cx: &DocContext,
2438
2437
}
2439
2438
} ;
2440
2439
let did = match primitive {
2441
- Isize => tcx. lang_items . isize_impl ( ) ,
2442
- I8 => tcx. lang_items . i8_impl ( ) ,
2443
- I16 => tcx. lang_items . i16_impl ( ) ,
2444
- I32 => tcx. lang_items . i32_impl ( ) ,
2445
- I64 => tcx. lang_items . i64_impl ( ) ,
2446
- Usize => tcx. lang_items . usize_impl ( ) ,
2447
- U8 => tcx. lang_items . u8_impl ( ) ,
2448
- U16 => tcx. lang_items . u16_impl ( ) ,
2449
- U32 => tcx. lang_items . u32_impl ( ) ,
2450
- U64 => tcx. lang_items . u64_impl ( ) ,
2451
- F32 => tcx. lang_items . f32_impl ( ) ,
2452
- F64 => tcx. lang_items . f64_impl ( ) ,
2453
- Char => tcx. lang_items . char_impl ( ) ,
2454
- Bool => None ,
2455
- Str => tcx. lang_items . str_impl ( ) ,
2456
- Slice => tcx. lang_items . slice_impl ( ) ,
2457
- Array => tcx. lang_items . slice_impl ( ) ,
2458
- PrimitiveTuple => None ,
2459
- PrimitiveRawPointer => tcx. lang_items . const_ptr_impl ( ) ,
2440
+ PrimitiveType :: Isize => tcx. lang_items . isize_impl ( ) ,
2441
+ PrimitiveType :: I8 => tcx. lang_items . i8_impl ( ) ,
2442
+ PrimitiveType :: I16 => tcx. lang_items . i16_impl ( ) ,
2443
+ PrimitiveType :: I32 => tcx. lang_items . i32_impl ( ) ,
2444
+ PrimitiveType :: I64 => tcx. lang_items . i64_impl ( ) ,
2445
+ PrimitiveType :: Usize => tcx. lang_items . usize_impl ( ) ,
2446
+ PrimitiveType :: U8 => tcx. lang_items . u8_impl ( ) ,
2447
+ PrimitiveType :: U16 => tcx. lang_items . u16_impl ( ) ,
2448
+ PrimitiveType :: U32 => tcx. lang_items . u32_impl ( ) ,
2449
+ PrimitiveType :: U64 => tcx. lang_items . u64_impl ( ) ,
2450
+ PrimitiveType :: F32 => tcx. lang_items . f32_impl ( ) ,
2451
+ PrimitiveType :: F64 => tcx. lang_items . f64_impl ( ) ,
2452
+ PrimitiveType :: Char => tcx. lang_items . char_impl ( ) ,
2453
+ PrimitiveType :: Bool => None ,
2454
+ PrimitiveType :: Str => tcx. lang_items . str_impl ( ) ,
2455
+ PrimitiveType :: Slice => tcx. lang_items . slice_impl ( ) ,
2456
+ PrimitiveType :: Array => tcx. lang_items . slice_impl ( ) ,
2457
+ PrimitiveType :: PrimitiveTuple => None ,
2458
+ PrimitiveType :: PrimitiveRawPointer => tcx. lang_items . const_ptr_impl ( ) ,
2460
2459
} ;
2461
2460
if let Some ( did) = did {
2462
2461
if !did. is_local ( ) {
@@ -2739,21 +2738,21 @@ fn resolve_type(cx: &DocContext,
2739
2738
2740
2739
let is_generic = match def {
2741
2740
Def :: PrimTy ( p) => match p {
2742
- hir:: TyStr => return Primitive ( Str ) ,
2743
- hir:: TyBool => return Primitive ( Bool ) ,
2744
- hir:: TyChar => return Primitive ( Char ) ,
2745
- hir:: TyInt ( ast:: IntTy :: Is ) => return Primitive ( Isize ) ,
2746
- hir:: TyInt ( ast:: IntTy :: I8 ) => return Primitive ( I8 ) ,
2747
- hir:: TyInt ( ast:: IntTy :: I16 ) => return Primitive ( I16 ) ,
2748
- hir:: TyInt ( ast:: IntTy :: I32 ) => return Primitive ( I32 ) ,
2749
- hir:: TyInt ( ast:: IntTy :: I64 ) => return Primitive ( I64 ) ,
2750
- hir:: TyUint ( ast:: UintTy :: Us ) => return Primitive ( Usize ) ,
2751
- hir:: TyUint ( ast:: UintTy :: U8 ) => return Primitive ( U8 ) ,
2752
- hir:: TyUint ( ast:: UintTy :: U16 ) => return Primitive ( U16 ) ,
2753
- hir:: TyUint ( ast:: UintTy :: U32 ) => return Primitive ( U32 ) ,
2754
- hir:: TyUint ( ast:: UintTy :: U64 ) => return Primitive ( U64 ) ,
2755
- hir:: TyFloat ( ast:: FloatTy :: F32 ) => return Primitive ( F32 ) ,
2756
- hir:: TyFloat ( ast:: FloatTy :: F64 ) => return Primitive ( F64 ) ,
2741
+ hir:: TyStr => return Primitive ( PrimitiveType :: Str ) ,
2742
+ hir:: TyBool => return Primitive ( PrimitiveType :: Bool ) ,
2743
+ hir:: TyChar => return Primitive ( PrimitiveType :: Char ) ,
2744
+ hir:: TyInt ( ast:: IntTy :: Is ) => return Primitive ( PrimitiveType :: Isize ) ,
2745
+ hir:: TyInt ( ast:: IntTy :: I8 ) => return Primitive ( PrimitiveType :: I8 ) ,
2746
+ hir:: TyInt ( ast:: IntTy :: I16 ) => return Primitive ( PrimitiveType :: I16 ) ,
2747
+ hir:: TyInt ( ast:: IntTy :: I32 ) => return Primitive ( PrimitiveType :: I32 ) ,
2748
+ hir:: TyInt ( ast:: IntTy :: I64 ) => return Primitive ( PrimitiveType :: I64 ) ,
2749
+ hir:: TyUint ( ast:: UintTy :: Us ) => return Primitive ( PrimitiveType :: Usize ) ,
2750
+ hir:: TyUint ( ast:: UintTy :: U8 ) => return Primitive ( PrimitiveType :: U8 ) ,
2751
+ hir:: TyUint ( ast:: UintTy :: U16 ) => return Primitive ( PrimitiveType :: U16 ) ,
2752
+ hir:: TyUint ( ast:: UintTy :: U32 ) => return Primitive ( PrimitiveType :: U32 ) ,
2753
+ hir:: TyUint ( ast:: UintTy :: U64 ) => return Primitive ( PrimitiveType :: U64 ) ,
2754
+ hir:: TyFloat ( ast:: FloatTy :: F32 ) => return Primitive ( PrimitiveType :: F32 ) ,
2755
+ hir:: TyFloat ( ast:: FloatTy :: F64 ) => return Primitive ( PrimitiveType :: F64 ) ,
2757
2756
} ,
2758
2757
Def :: SelfTy ( ..) if path. segments . len ( ) == 1 => {
2759
2758
return Generic ( keywords:: SelfType . name ( ) . to_string ( ) ) ;
0 commit comments