|
11 | 11 | //! Functions concerning immediate values and operands, and reading from operands.
|
12 | 12 | //! All high-level functions to read from memory work on operands as sources.
|
13 | 13 |
|
14 |
| -use std::hash::{Hash, Hasher}; |
15 | 14 | use std::convert::TryInto;
|
16 | 15 |
|
17 | 16 | use rustc::{mir, ty};
|
@@ -221,7 +220,7 @@ impl Operand {
|
221 | 220 | }
|
222 | 221 | }
|
223 | 222 |
|
224 |
| -#[derive(Copy, Clone, Debug)] |
| 223 | +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] |
225 | 224 | pub struct OpTy<'tcx> {
|
226 | 225 | crate op: Operand, // ideally we'd make this private, but const_prop needs this
|
227 | 226 | pub layout: TyLayout<'tcx>,
|
@@ -255,20 +254,6 @@ impl<'tcx> From<ValTy<'tcx>> for OpTy<'tcx> {
|
255 | 254 | }
|
256 | 255 | }
|
257 | 256 |
|
258 |
| -// Validation needs to hash OpTy, but we cannot hash Layout -- so we just hash the type |
259 |
| -impl<'tcx> Hash for OpTy<'tcx> { |
260 |
| - fn hash<H: Hasher>(&self, state: &mut H) { |
261 |
| - self.op.hash(state); |
262 |
| - self.layout.ty.hash(state); |
263 |
| - } |
264 |
| -} |
265 |
| -impl<'tcx> PartialEq for OpTy<'tcx> { |
266 |
| - fn eq(&self, other: &Self) -> bool { |
267 |
| - self.op == other.op && self.layout.ty == other.layout.ty |
268 |
| - } |
269 |
| -} |
270 |
| -impl<'tcx> Eq for OpTy<'tcx> {} |
271 |
| - |
272 | 257 | // Use the existing layout if given (but sanity check in debug mode),
|
273 | 258 | // or compute the layout.
|
274 | 259 | #[inline(always)]
|
|
0 commit comments