Skip to content

Commit

Permalink
Remove unused error variants
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 30, 2018
1 parent 64e6dda commit 21c2b71
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
5 changes: 0 additions & 5 deletions src/librustc/ich/impls_const_math.rs
Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/middle/const_val.rs
Expand Up @@ -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)
}
}

Expand Down
22 changes: 0 additions & 22 deletions src/librustc_const_math/err.rs
Expand Up @@ -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::*;

Expand All @@ -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",
Expand All @@ -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",
}
}
}

0 comments on commit 21c2b71

Please sign in to comment.