Skip to content

Commit b077049

Browse files
committed
remove some unused trait impls
these are not things you *should* usually be comparing for equality...
1 parent 3740152 commit b077049

File tree

3 files changed

+9
-43
lines changed

3 files changed

+9
-43
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ use std::cell::Cell;
22
use std::fmt;
33
use std::mem;
44

5-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
65
use rustc_hir::{self as hir, def_id::DefId, definitions::DefPathData};
76
use rustc_index::vec::IndexVec;
8-
use rustc_macros::HashStable;
97
use rustc_middle::mir;
108
use rustc_middle::mir::interpret::{InterpError, InvalidProgramInfo};
119
use rustc_middle::ty::layout::{
@@ -16,7 +14,6 @@ use rustc_middle::ty::{
1614
self, query::TyCtxtAt, subst::SubstsRef, ParamEnv, Ty, TyCtxt, TypeFoldable,
1715
};
1816
use rustc_mir_dataflow::storage::always_storage_live_locals;
19-
use rustc_query_system::ich::StableHashingContext;
2017
use rustc_session::Limit;
2118
use rustc_span::{Pos, Span};
2219
use rustc_target::abi::{call::FnAbi, Align, HasDataLayout, Size, TargetDataLayout};
@@ -142,7 +139,7 @@ pub struct FrameInfo<'tcx> {
142139
}
143140

144141
/// Unwind information.
145-
#[derive(Clone, Copy, Eq, PartialEq, Debug, HashStable)]
142+
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
146143
pub enum StackPopUnwind {
147144
/// The cleanup block.
148145
Cleanup(mir::BasicBlock),
@@ -152,7 +149,7 @@ pub enum StackPopUnwind {
152149
NotAllowed,
153150
}
154151

155-
#[derive(Clone, Copy, Eq, PartialEq, Debug, HashStable)] // Miri debug-prints these
152+
#[derive(Clone, Copy, Eq, PartialEq, Debug)] // Miri debug-prints these
156153
pub enum StackPopCleanup {
157154
/// Jump to the next block in the caller, or cause UB if None (that's a function
158155
/// that may never return). Also store layout of return place so
@@ -168,16 +165,15 @@ pub enum StackPopCleanup {
168165
}
169166

170167
/// State of a local variable including a memoized layout
171-
#[derive(Clone, Debug, PartialEq, Eq, HashStable)]
168+
#[derive(Clone, Debug)]
172169
pub struct LocalState<'tcx, Tag: Provenance = AllocId> {
173170
pub value: LocalValue<Tag>,
174171
/// Don't modify if `Some`, this is only used to prevent computing the layout twice
175-
#[stable_hasher(ignore)]
176172
pub layout: Cell<Option<TyAndLayout<'tcx>>>,
177173
}
178174

179175
/// Current value of a local variable
180-
#[derive(Copy, Clone, PartialEq, Eq, HashStable, Debug)] // Miri debug-prints these
176+
#[derive(Copy, Clone, Debug)] // Miri debug-prints these
181177
pub enum LocalValue<Tag: Provenance = AllocId> {
182178
/// This local is not currently alive, and cannot be used at all.
183179
Dead,
@@ -1021,31 +1017,3 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> std::fmt::Debug
10211017
}
10221018
}
10231019
}
1024-
1025-
impl<'ctx, 'mir, 'tcx, Tag: Provenance, Extra> HashStable<StableHashingContext<'ctx>>
1026-
for Frame<'mir, 'tcx, Tag, Extra>
1027-
where
1028-
Extra: HashStable<StableHashingContext<'ctx>>,
1029-
Tag: HashStable<StableHashingContext<'ctx>>,
1030-
{
1031-
fn hash_stable(&self, hcx: &mut StableHashingContext<'ctx>, hasher: &mut StableHasher) {
1032-
// Exhaustive match on fields to make sure we forget no field.
1033-
let Frame {
1034-
body,
1035-
instance,
1036-
return_to_block,
1037-
return_place,
1038-
locals,
1039-
loc,
1040-
extra,
1041-
tracing_span: _,
1042-
} = self;
1043-
body.hash_stable(hcx, hasher);
1044-
instance.hash_stable(hcx, hasher);
1045-
return_to_block.hash_stable(hcx, hasher);
1046-
return_place.hash_stable(hcx, hasher);
1047-
locals.hash_stable(hcx, hasher);
1048-
loc.hash_stable(hcx, hasher);
1049-
extra.hash_stable(hcx, hasher);
1050-
}
1051-
}

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use std::fmt::Write;
55

66
use rustc_hir::def::Namespace;
7-
use rustc_macros::HashStable;
87
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
98
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter, Printer};
109
use rustc_middle::ty::{ConstInt, DelaySpanBugEmitted, Ty};
@@ -25,7 +24,7 @@ use super::{
2524
/// operations and wide pointers. This idea was taken from rustc's codegen.
2625
/// In particular, thanks to `ScalarPair`, arithmetic operations and casts can be entirely
2726
/// defined on `Immediate`, and do not have to work with a `Place`.
28-
#[derive(Copy, Clone, PartialEq, Eq, HashStable, Hash, Debug)]
27+
#[derive(Copy, Clone, Debug)]
2928
pub enum Immediate<Tag: Provenance = AllocId> {
3029
/// A single scalar value (must have *initialized* `Scalar` ABI).
3130
/// FIXME: we also currently often use this for ZST.
@@ -225,7 +224,7 @@ impl<'tcx, Tag: Provenance> ImmTy<'tcx, Tag> {
225224
/// An `Operand` is the result of computing a `mir::Operand`. It can be immediate,
226225
/// or still in memory. The latter is an optimization, to delay reading that chunk of
227226
/// memory and to avoid having to store arbitrary-sized data here.
228-
#[derive(Copy, Clone, PartialEq, Eq, HashStable, Hash, Debug)]
227+
#[derive(Copy, Clone, Debug)]
229228
pub enum Operand<Tag: Provenance = AllocId> {
230229
Immediate(Immediate<Tag>),
231230
Indirect(MemPlace<Tag>),

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use std::hash::Hash;
66

77
use rustc_ast::Mutability;
8-
use rustc_macros::HashStable;
98
use rustc_middle::mir;
109
use rustc_middle::ty;
1110
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
@@ -17,7 +16,7 @@ use super::{
1716
Pointer, Provenance, Scalar, ScalarMaybeUninit,
1817
};
1918

20-
#[derive(Copy, Clone, Hash, PartialEq, Eq, HashStable, Debug)]
19+
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
2120
/// Information required for the sound usage of a `MemPlace`.
2221
pub enum MemPlaceMeta<Tag: Provenance = AllocId> {
2322
/// The unsized payload (e.g. length for slices or vtable pointer for trait objects).
@@ -51,7 +50,7 @@ impl<Tag: Provenance> MemPlaceMeta<Tag> {
5150
}
5251
}
5352

54-
#[derive(Copy, Clone, Hash, PartialEq, Eq, HashStable, Debug)]
53+
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
5554
pub struct MemPlace<Tag: Provenance = AllocId> {
5655
/// The pointer can be a pure integer, with the `None` tag.
5756
pub ptr: Pointer<Option<Tag>>,
@@ -64,7 +63,7 @@ pub struct MemPlace<Tag: Provenance = AllocId> {
6463
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
6564
rustc_data_structures::static_assert_size!(MemPlace, 40);
6665

67-
#[derive(Copy, Clone, Hash, PartialEq, Eq, HashStable, Debug)]
66+
#[derive(Copy, Clone, Debug)]
6867
pub enum Place<Tag: Provenance = AllocId> {
6968
/// A place referring to a value allocated in the `Memory` system.
7069
Ptr(MemPlace<Tag>),

0 commit comments

Comments
 (0)