Remove unused error variants
This commit is contained in:
parent
64e6dda0bc
commit
21c2b71405
@ -17,16 +17,11 @@ impl_stable_hash_for!(struct ::rustc_const_math::ConstFloat {
|
||||
});
|
||||
|
||||
impl_stable_hash_for!(enum ::rustc_const_math::ConstMathErr {
|
||||
NotInRange,
|
||||
CmpBetweenUnequalTypes,
|
||||
UnequalTypes(op),
|
||||
Overflow(op),
|
||||
ShiftNegative,
|
||||
DivisionByZero,
|
||||
RemainderByZero,
|
||||
UnsignedNegation,
|
||||
ULitOutOfRange(int_ty),
|
||||
LitOutOfRange(int_ty)
|
||||
});
|
||||
|
||||
impl_stable_hash_for!(enum ::rustc_const_math::Op {
|
||||
|
@ -78,10 +78,7 @@ pub struct FrameInfo {
|
||||
|
||||
impl<'tcx> From<ConstMathErr> for ErrKind<'tcx> {
|
||||
fn from(err: ConstMathErr) -> ErrKind<'tcx> {
|
||||
match err {
|
||||
ConstMathErr::UnsignedNegation => ErrKind::TypeckError,
|
||||
_ => ErrKind::Math(err)
|
||||
}
|
||||
ErrKind::Math(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,20 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax::ast;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
|
||||
pub enum ConstMathErr {
|
||||
NotInRange,
|
||||
CmpBetweenUnequalTypes,
|
||||
UnequalTypes(Op),
|
||||
Overflow(Op),
|
||||
ShiftNegative,
|
||||
DivisionByZero,
|
||||
RemainderByZero,
|
||||
UnsignedNegation,
|
||||
ULitOutOfRange(ast::UintTy),
|
||||
LitOutOfRange(ast::IntTy),
|
||||
}
|
||||
pub use self::ConstMathErr::*;
|
||||
|
||||
@ -44,7 +37,6 @@ impl ConstMathErr {
|
||||
pub fn description(&self) -> &'static str {
|
||||
use self::Op::*;
|
||||
match *self {
|
||||
NotInRange => "inferred value out of range",
|
||||
CmpBetweenUnequalTypes => "compared two values of different types",
|
||||
UnequalTypes(Add) => "tried to add two values of different types",
|
||||
UnequalTypes(Sub) => "tried to subtract two values of different types",
|
||||
@ -66,22 +58,8 @@ impl ConstMathErr {
|
||||
Overflow(Shr) => "attempt to shift right with overflow",
|
||||
Overflow(Shl) => "attempt to shift left with overflow",
|
||||
Overflow(_) => unreachable!(),
|
||||
ShiftNegative => "attempt to shift by a negative amount",
|
||||
DivisionByZero => "attempt to divide by zero",
|
||||
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
|
||||
UnsignedNegation => "unary negation of unsigned integer",
|
||||
ULitOutOfRange(ast::UintTy::U8) => "literal out of range for u8",
|
||||
ULitOutOfRange(ast::UintTy::U16) => "literal out of range for u16",
|
||||
ULitOutOfRange(ast::UintTy::U32) => "literal out of range for u32",
|
||||
ULitOutOfRange(ast::UintTy::U64) => "literal out of range for u64",
|
||||
ULitOutOfRange(ast::UintTy::U128) => "literal out of range for u128",
|
||||
ULitOutOfRange(ast::UintTy::Usize) => "literal out of range for usize",
|
||||
LitOutOfRange(ast::IntTy::I8) => "literal out of range for i8",
|
||||
LitOutOfRange(ast::IntTy::I16) => "literal out of range for i16",
|
||||
LitOutOfRange(ast::IntTy::I32) => "literal out of range for i32",
|
||||
LitOutOfRange(ast::IntTy::I64) => "literal out of range for i64",
|
||||
LitOutOfRange(ast::IntTy::I128) => "literal out of range for i128",
|
||||
LitOutOfRange(ast::IntTy::Isize) => "literal out of range for isize",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user