Skip to content

Commit 0d8321b

Browse files
committed
Auto merge of #50198 - oli-obk:const_prop, r=eddyb
Remove some unused code
2 parents a4a7947 + 487f7bc commit 0d8321b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+270
-727
lines changed

src/Cargo.lock

-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/librustc/Cargo.toml

-1
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

-44
This file was deleted.

src/librustc/ich/impls_mir.rs

-21
Original file line numberDiff line numberDiff line change
@@ -227,27 +227,6 @@ for mir::TerminatorKind<'gcx> {
227227
}
228228
}
229229

230-
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
231-
for mir::AssertMessage<'gcx> {
232-
fn hash_stable<W: StableHasherResult>(&self,
233-
hcx: &mut StableHashingContext<'a>,
234-
hasher: &mut StableHasher<W>) {
235-
mem::discriminant(self).hash_stable(hcx, hasher);
236-
237-
match *self {
238-
mir::AssertMessage::BoundsCheck { ref len, ref index } => {
239-
len.hash_stable(hcx, hasher);
240-
index.hash_stable(hcx, hasher);
241-
}
242-
mir::AssertMessage::Math(ref const_math_err) => {
243-
const_math_err.hash_stable(hcx, hasher);
244-
}
245-
mir::AssertMessage::GeneratorResumedAfterReturn => (),
246-
mir::AssertMessage::GeneratorResumedAfterPanic => (),
247-
}
248-
}
249-
}
250-
251230
impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind });
252231

253232
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>

src/librustc/ich/impls_ty.rs

+22-15
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,6 @@ for ::middle::const_val::ErrKind<'gcx> {
505505
len.hash_stable(hcx, hasher);
506506
index.hash_stable(hcx, hasher);
507507
}
508-
Math(ref const_math_err) => {
509-
const_math_err.hash_stable(hcx, hasher);
510-
}
511508
LayoutError(ref layout_error) => {
512509
layout_error.hash_stable(hcx, hasher);
513510
}
@@ -528,16 +525,26 @@ impl_stable_hash_for!(struct ty::GenericPredicates<'tcx> {
528525
predicates
529526
});
530527

528+
531529
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
532530
for ::mir::interpret::EvalError<'gcx> {
531+
fn hash_stable<W: StableHasherResult>(&self,
532+
hcx: &mut StableHashingContext<'a>,
533+
hasher: &mut StableHasher<W>) {
534+
self.kind.hash_stable(hcx, hasher)
535+
}
536+
}
537+
538+
impl<'a, 'gcx, O: HashStable<StableHashingContext<'a>>> HashStable<StableHashingContext<'a>>
539+
for ::mir::interpret::EvalErrorKind<'gcx, O> {
533540
fn hash_stable<W: StableHasherResult>(&self,
534541
hcx: &mut StableHashingContext<'a>,
535542
hasher: &mut StableHasher<W>) {
536543
use mir::interpret::EvalErrorKind::*;
537544

538-
mem::discriminant(&self.kind).hash_stable(hcx, hasher);
545+
mem::discriminant(&self).hash_stable(hcx, hasher);
539546

540-
match self.kind {
547+
match *self {
541548
DanglingPointerDeref |
542549
DoubleFree |
543550
InvalidMemoryAccess |
@@ -568,8 +575,12 @@ for ::mir::interpret::EvalError<'gcx> {
568575
TypeckError |
569576
DerefFunctionPointer |
570577
ExecuteMemory |
571-
ReferencedConstant |
572-
OverflowingMath => {}
578+
OverflowNeg |
579+
RemainderByZero |
580+
DivisionByZero |
581+
GeneratorResumedAfterReturn |
582+
GeneratorResumedAfterPanic |
583+
ReferencedConstant => {}
573584
MachineError(ref err) => err.hash_stable(hcx, hasher),
574585
FunctionPointerTyMismatch(a, b) => {
575586
a.hash_stable(hcx, hasher);
@@ -588,14 +599,9 @@ for ::mir::interpret::EvalError<'gcx> {
588599
},
589600
InvalidBoolOp(bop) => bop.hash_stable(hcx, hasher),
590601
Unimplemented(ref s) => s.hash_stable(hcx, hasher),
591-
ArrayIndexOutOfBounds(sp, a, b) => {
592-
sp.hash_stable(hcx, hasher);
593-
a.hash_stable(hcx, hasher);
594-
b.hash_stable(hcx, hasher)
595-
},
596-
Math(sp, ref err) => {
597-
sp.hash_stable(hcx, hasher);
598-
err.hash_stable(hcx, hasher)
602+
BoundsCheck { ref len, ref index } => {
603+
len.hash_stable(hcx, hasher);
604+
index.hash_stable(hcx, hasher)
599605
},
600606
Intrinsic(ref s) => s.hash_stable(hcx, hasher),
601607
InvalidChar(c) => c.hash_stable(hcx, hasher),
@@ -668,6 +674,7 @@ for ::mir::interpret::EvalError<'gcx> {
668674
Layout(lay) => lay.hash_stable(hcx, hasher),
669675
HeapAllocNonPowerOfTwoAlignment(n) => n.hash_stable(hcx, hasher),
670676
PathNotFound(ref v) => v.hash_stable(hcx, hasher),
677+
Overflow(op) => op.hash_stable(hcx, hasher),
671678
}
672679
}
673680
}

src/librustc/ich/mod.rs

-1
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

-1
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/middle/const_val.rs

-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use hir::def_id::DefId;
1212
use ty::{self, TyCtxt, layout};
1313
use ty::subst::Substs;
14-
use rustc_const_math::*;
1514
use mir::interpret::{Value, PrimVal};
1615
use errors::DiagnosticBuilder;
1716

@@ -62,7 +61,6 @@ pub enum ErrKind<'tcx> {
6261
UnimplementedConstVal(&'static str),
6362
IndexOutOfBounds { len: u64, index: u64 },
6463

65-
Math(ConstMathErr),
6664
LayoutError(layout::LayoutError<'tcx>),
6765

6866
TypeckError,
@@ -76,15 +74,6 @@ pub struct FrameInfo {
7674
pub location: String,
7775
}
7876

79-
impl<'tcx> From<ConstMathErr> for ErrKind<'tcx> {
80-
fn from(err: ConstMathErr) -> ErrKind<'tcx> {
81-
match err {
82-
ConstMathErr::UnsignedNegation => ErrKind::TypeckError,
83-
_ => ErrKind::Math(err)
84-
}
85-
}
86-
}
87-
8877
#[derive(Clone, Debug)]
8978
pub enum ConstEvalErrDescription<'a, 'tcx: 'a> {
9079
Simple(Cow<'a, str>),
@@ -122,7 +111,6 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
122111
len, index)
123112
}
124113

125-
Math(ref err) => Simple(err.description().into_cow()),
126114
LayoutError(ref err) => Simple(err.to_string().into_cow()),
127115

128116
TypeckError => simple!("type-checking failed"),

0 commit comments

Comments
 (0)