8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use syntax:: ast;
12
-
13
11
#[ derive( Debug , PartialEq , Eq , Clone , RustcEncodable , RustcDecodable ) ]
14
12
pub enum ConstMathErr {
15
- NotInRange ,
16
13
CmpBetweenUnequalTypes ,
17
14
UnequalTypes ( Op ) ,
18
15
Overflow ( Op ) ,
19
- ShiftNegative ,
20
16
DivisionByZero ,
21
17
RemainderByZero ,
22
- UnsignedNegation ,
23
- ULitOutOfRange ( ast:: UintTy ) ,
24
- LitOutOfRange ( ast:: IntTy ) ,
25
18
}
26
19
pub use self :: ConstMathErr :: * ;
27
20
@@ -44,7 +37,6 @@ impl ConstMathErr {
44
37
pub fn description ( & self ) -> & ' static str {
45
38
use self :: Op :: * ;
46
39
match * self {
47
- NotInRange => "inferred value out of range" ,
48
40
CmpBetweenUnequalTypes => "compared two values of different types" ,
49
41
UnequalTypes ( Add ) => "tried to add two values of different types" ,
50
42
UnequalTypes ( Sub ) => "tried to subtract two values of different types" ,
@@ -66,22 +58,8 @@ impl ConstMathErr {
66
58
Overflow ( Shr ) => "attempt to shift right with overflow" ,
67
59
Overflow ( Shl ) => "attempt to shift left with overflow" ,
68
60
Overflow ( _) => unreachable ! ( ) ,
69
- ShiftNegative => "attempt to shift by a negative amount" ,
70
61
DivisionByZero => "attempt to divide by zero" ,
71
62
RemainderByZero => "attempt to calculate the remainder with a divisor of zero" ,
72
- UnsignedNegation => "unary negation of unsigned integer" ,
73
- ULitOutOfRange ( ast:: UintTy :: U8 ) => "literal out of range for u8" ,
74
- ULitOutOfRange ( ast:: UintTy :: U16 ) => "literal out of range for u16" ,
75
- ULitOutOfRange ( ast:: UintTy :: U32 ) => "literal out of range for u32" ,
76
- ULitOutOfRange ( ast:: UintTy :: U64 ) => "literal out of range for u64" ,
77
- ULitOutOfRange ( ast:: UintTy :: U128 ) => "literal out of range for u128" ,
78
- ULitOutOfRange ( ast:: UintTy :: Usize ) => "literal out of range for usize" ,
79
- LitOutOfRange ( ast:: IntTy :: I8 ) => "literal out of range for i8" ,
80
- LitOutOfRange ( ast:: IntTy :: I16 ) => "literal out of range for i16" ,
81
- LitOutOfRange ( ast:: IntTy :: I32 ) => "literal out of range for i32" ,
82
- LitOutOfRange ( ast:: IntTy :: I64 ) => "literal out of range for i64" ,
83
- LitOutOfRange ( ast:: IntTy :: I128 ) => "literal out of range for i128" ,
84
- LitOutOfRange ( ast:: IntTy :: Isize ) => "literal out of range for isize" ,
85
63
}
86
64
}
87
65
}
0 commit comments