@@ -24,13 +24,14 @@ use {Entry, HashMap};
24
24
///
25
25
/// We initially assume that all types are `ZeroSized` and then update our
26
26
/// understanding as we learn more about each type.
27
- #[ derive( Copy , Clone , Debug , PartialEq , Eq , Ord ) ]
27
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
28
28
pub enum SizednessResult {
29
- /// Has some size that is known to be greater than zero. That doesn't mean
30
- /// it has a static size, but it is not zero sized for sure. In other words,
31
- /// it might contain an incomplete array or some other dynamically sized
32
- /// type.
33
- NonZeroSized ,
29
+ /// The type is zero-sized.
30
+ ///
31
+ /// This means that if it is a C++ type, and is not being used as a base
32
+ /// member, then we must add an `_address` byte to enforce the
33
+ /// unique-address-per-distinct-object-instance rule.
34
+ ZeroSized ,
34
35
35
36
/// Whether this type is zero-sized or not depends on whether a type
36
37
/// parameter is zero-sized or not.
@@ -54,12 +55,11 @@ pub enum SizednessResult {
54
55
/// https://github.com/rust-lang/rust-bindgen/issues/586
55
56
DependsOnTypeParam ,
56
57
57
- /// The type is zero-sized.
58
- ///
59
- /// This means that if it is a C++ type, and is not being used as a base
60
- /// member, then we must add an `_address` byte to enforce the
61
- /// unique-address-per-distinct-object-instance rule.
62
- ZeroSized ,
58
+ /// Has some size that is known to be greater than zero. That doesn't mean
59
+ /// it has a static size, but it is not zero sized for sure. In other words,
60
+ /// it might contain an incomplete array or some other dynamically sized
61
+ /// type.
62
+ NonZeroSized ,
63
63
}
64
64
65
65
impl Default for SizednessResult {
@@ -68,21 +68,6 @@ impl Default for SizednessResult {
68
68
}
69
69
}
70
70
71
- impl cmp:: PartialOrd for SizednessResult {
72
- fn partial_cmp ( & self , rhs : & Self ) -> Option < cmp:: Ordering > {
73
- use self :: SizednessResult :: * ;
74
-
75
- match ( * self , * rhs) {
76
- ( x, y) if x == y => Some ( cmp:: Ordering :: Equal ) ,
77
- ( NonZeroSized , _) => Some ( cmp:: Ordering :: Greater ) ,
78
- ( _, NonZeroSized ) => Some ( cmp:: Ordering :: Less ) ,
79
- ( DependsOnTypeParam , _) => Some ( cmp:: Ordering :: Greater ) ,
80
- ( _, DependsOnTypeParam ) => Some ( cmp:: Ordering :: Less ) ,
81
- _ => unreachable ! ( ) ,
82
- }
83
- }
84
- }
85
-
86
71
impl SizednessResult {
87
72
/// Take the least upper bound of `self` and `rhs`.
88
73
pub fn join ( self , rhs : Self ) -> Self {
0 commit comments