Skip to content

Commit 671b2a5

Browse files
committed
Remove the rustc_const_math crate
1 parent cf103e5 commit 671b2a5

File tree

17 files changed

+60
-132
lines changed

17 files changed

+60
-132
lines changed

src/librustc/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ log = { version = "0.4", features = ["release_max_level_info", "std"] }
1919
proc_macro = { path = "../libproc_macro" }
2020
rustc_apfloat = { path = "../librustc_apfloat" }
2121
rustc_target = { path = "../librustc_target" }
22-
rustc_const_math = { path = "../librustc_const_math" }
2322
rustc_data_structures = { path = "../librustc_data_structures" }
2423
rustc_errors = { path = "../librustc_errors" }
2524
serialize = { path = "../libserialize" }

src/librustc/ich/impls_const_math.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/librustc/ich/impls_ty.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,23 @@ for ::mir::interpret::EvalError<'gcx> {
669669
}
670670
}
671671

672+
impl_stable_hash_for!(enum mir::interpret::ConstMathErr {
673+
Overflow(op),
674+
DivisionByZero,
675+
RemainderByZero,
676+
});
677+
678+
impl_stable_hash_for!(enum mir::interpret::Op {
679+
Add,
680+
Sub,
681+
Mul,
682+
Div,
683+
Rem,
684+
Shr,
685+
Shl,
686+
Neg,
687+
});
688+
672689
impl_stable_hash_for!(enum mir::interpret::Lock {
673690
NoLock,
674691
WriteLock(dl),

src/librustc/ich/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ mod fingerprint;
1818
mod caching_codemap_view;
1919
mod hcx;
2020

21-
mod impls_const_math;
2221
mod impls_cstore;
2322
mod impls_hir;
2423
mod impls_mir;

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ extern crate libc;
8585
extern crate rustc_target;
8686
#[macro_use] extern crate rustc_data_structures;
8787
extern crate serialize;
88-
extern crate rustc_const_math;
8988
extern crate rustc_errors as errors;
9089
#[macro_use] extern crate log;
9190
#[macro_use] extern crate syntax;

src/librustc/mir/interpret/error.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use super::{
88
MemoryPointer, Lock, AccessKind
99
};
1010

11-
use rustc_const_math::ConstMathErr;
1211
use syntax::codemap::Span;
1312
use backtrace::Backtrace;
1413

@@ -304,3 +303,41 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
304303
}
305304
}
306305
}
306+
307+
#[derive(Debug, PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
308+
pub enum ConstMathErr {
309+
Overflow(Op),
310+
DivisionByZero,
311+
RemainderByZero,
312+
}
313+
pub use self::ConstMathErr::*;
314+
315+
#[derive(Debug, PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
316+
pub enum Op {
317+
Add,
318+
Sub,
319+
Mul,
320+
Div,
321+
Rem,
322+
Shr,
323+
Shl,
324+
Neg,
325+
}
326+
327+
impl ConstMathErr {
328+
pub fn description(&self) -> &'static str {
329+
use self::Op::*;
330+
match *self {
331+
Overflow(Add) => "attempt to add with overflow",
332+
Overflow(Sub) => "attempt to subtract with overflow",
333+
Overflow(Mul) => "attempt to multiply with overflow",
334+
Overflow(Div) => "attempt to divide with overflow",
335+
Overflow(Rem) => "attempt to calculate the remainder with overflow",
336+
Overflow(Neg) => "attempt to negate with overflow",
337+
Overflow(Shr) => "attempt to shift right with overflow",
338+
Overflow(Shl) => "attempt to shift left with overflow",
339+
DivisionByZero => "attempt to divide by zero",
340+
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
341+
}
342+
}
343+
}

src/librustc/mir/interpret/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ macro_rules! err {
88
mod error;
99
mod value;
1010

11-
pub use self::error::{EvalError, EvalResult, EvalErrorKind};
11+
pub use self::error::{EvalError, EvalResult, EvalErrorKind, Op, ConstMathErr};
1212

1313
pub use self::value::{PrimVal, PrimValKind, Value, Pointer};
1414

src/librustc/mir/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use graphviz::IntoCow;
1616
use middle::const_val::ConstVal;
1717
use middle::region;
18-
use rustc_const_math::ConstMathErr;
1918
use rustc_data_structures::sync::{Lrc};
2019
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
2120
use rustc_data_structures::control_flow_graph::dominators::{Dominators, dominators};
@@ -26,7 +25,7 @@ use rustc_serialize as serialize;
2625
use hir::def::CtorKind;
2726
use hir::def_id::DefId;
2827
use mir::visit::MirVisitable;
29-
use mir::interpret::{Value, PrimVal};
28+
use mir::interpret::{Value, PrimVal, ConstMathErr};
3029
use ty::subst::{Subst, Substs};
3130
use ty::{self, AdtDef, CanonicalTy, ClosureSubsts, Region, Ty, TyCtxt, GeneratorInterior};
3231
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};

src/librustc_const_math/Cargo.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/librustc_const_math/err.rs

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)