@@ -238,6 +238,7 @@ impl Clean<ExternalCrate> for CrateNum {
238
238
if prim. is_some ( ) {
239
239
break ;
240
240
}
241
+ // FIXME: should warn on unknown primitives?
241
242
}
242
243
}
243
244
}
@@ -1627,6 +1628,7 @@ pub enum PrimitiveType {
1627
1628
Slice ,
1628
1629
Array ,
1629
1630
Tuple ,
1631
+ Unit ,
1630
1632
RawPointer ,
1631
1633
Reference ,
1632
1634
Fn ,
@@ -1662,7 +1664,11 @@ impl Type {
1662
1664
Primitive ( p) | BorrowedRef { type_ : box Primitive ( p) , ..} => Some ( p) ,
1663
1665
Slice ( ..) | BorrowedRef { type_ : box Slice ( ..) , .. } => Some ( PrimitiveType :: Slice ) ,
1664
1666
Array ( ..) | BorrowedRef { type_ : box Array ( ..) , .. } => Some ( PrimitiveType :: Array ) ,
1665
- Tuple ( ..) => Some ( PrimitiveType :: Tuple ) ,
1667
+ Tuple ( ref tys) => if tys. is_empty ( ) {
1668
+ Some ( PrimitiveType :: Unit )
1669
+ } else {
1670
+ Some ( PrimitiveType :: Tuple )
1671
+ } ,
1666
1672
RawPointer ( ..) => Some ( PrimitiveType :: RawPointer ) ,
1667
1673
BorrowedRef { type_ : box Generic ( ..) , .. } => Some ( PrimitiveType :: Reference ) ,
1668
1674
BareFunction ( ..) => Some ( PrimitiveType :: Fn ) ,
@@ -1708,7 +1714,11 @@ impl GetDefId for Type {
1708
1714
BorrowedRef { type_ : box Generic ( ..) , .. } =>
1709
1715
Primitive ( PrimitiveType :: Reference ) . def_id ( ) ,
1710
1716
BorrowedRef { ref type_, .. } => type_. def_id ( ) ,
1711
- Tuple ( ..) => Primitive ( PrimitiveType :: Tuple ) . def_id ( ) ,
1717
+ Tuple ( ref tys) => if tys. is_empty ( ) {
1718
+ Primitive ( PrimitiveType :: Unit ) . def_id ( )
1719
+ } else {
1720
+ Primitive ( PrimitiveType :: Tuple ) . def_id ( )
1721
+ } ,
1712
1722
BareFunction ( ..) => Primitive ( PrimitiveType :: Fn ) . def_id ( ) ,
1713
1723
Slice ( ..) => Primitive ( PrimitiveType :: Slice ) . def_id ( ) ,
1714
1724
Array ( ..) => Primitive ( PrimitiveType :: Array ) . def_id ( ) ,
@@ -1742,6 +1752,7 @@ impl PrimitiveType {
1742
1752
"array" => Some ( PrimitiveType :: Array ) ,
1743
1753
"slice" => Some ( PrimitiveType :: Slice ) ,
1744
1754
"tuple" => Some ( PrimitiveType :: Tuple ) ,
1755
+ "unit" => Some ( PrimitiveType :: Unit ) ,
1745
1756
"pointer" => Some ( PrimitiveType :: RawPointer ) ,
1746
1757
"reference" => Some ( PrimitiveType :: Reference ) ,
1747
1758
"fn" => Some ( PrimitiveType :: Fn ) ,
@@ -1772,6 +1783,7 @@ impl PrimitiveType {
1772
1783
Array => "array" ,
1773
1784
Slice => "slice" ,
1774
1785
Tuple => "tuple" ,
1786
+ Unit => "unit" ,
1775
1787
RawPointer => "pointer" ,
1776
1788
Reference => "reference" ,
1777
1789
Fn => "fn" ,
@@ -2693,6 +2705,7 @@ fn build_deref_target_impls(cx: &DocContext,
2693
2705
Slice => tcx. lang_items ( ) . slice_impl ( ) ,
2694
2706
Array => tcx. lang_items ( ) . slice_impl ( ) ,
2695
2707
Tuple => None ,
2708
+ Unit => None ,
2696
2709
RawPointer => tcx. lang_items ( ) . const_ptr_impl ( ) ,
2697
2710
Reference => None ,
2698
2711
Fn => None ,
0 commit comments