|
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};
|
@@ -290,7 +289,7 @@ impl<Tag> Operand<Tag> {
|
290 | 289 | }
|
291 | 290 | }
|
292 | 291 |
|
293 |
| -#[derive(Copy, Clone, Debug)] |
| 292 | +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] |
294 | 293 | pub struct OpTy<'tcx, Tag=()> {
|
295 | 294 | crate op: Operand<Tag>, // ideally we'd make this private, but const_prop needs this
|
296 | 295 | pub layout: TyLayout<'tcx>,
|
@@ -324,26 +323,6 @@ impl<'tcx, Tag> From<ValTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
|
324 | 323 | }
|
325 | 324 | }
|
326 | 325 |
|
327 |
| -// Validation needs to hash OpTy, but we cannot hash Layout -- so we just hash the type |
328 |
| -impl<'tcx, Tag> Hash for OpTy<'tcx, Tag> |
329 |
| - where Tag: Hash |
330 |
| -{ |
331 |
| - fn hash<H: Hasher>(&self, state: &mut H) { |
332 |
| - self.op.hash(state); |
333 |
| - self.layout.ty.hash(state); |
334 |
| - } |
335 |
| -} |
336 |
| -impl<'tcx, Tag> PartialEq for OpTy<'tcx, Tag> |
337 |
| - where Tag: PartialEq |
338 |
| -{ |
339 |
| - fn eq(&self, other: &Self) -> bool { |
340 |
| - self.op == other.op && self.layout.ty == other.layout.ty |
341 |
| - } |
342 |
| -} |
343 |
| -impl<'tcx, Tag> Eq for OpTy<'tcx, Tag> |
344 |
| - where Tag: Eq |
345 |
| -{} |
346 |
| - |
347 | 326 | impl<'tcx, Tag> OpTy<'tcx, Tag>
|
348 | 327 | {
|
349 | 328 | #[inline]
|
|
0 commit comments