Skip to content

Commit 4420fff

Browse files
csmoespastorino
authored andcommitted
impl hash_stable for neo_place
1 parent 971d093 commit 4420fff

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,27 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Place<'gcx> {
220220
}
221221
}
222222

223+
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::PlaceBase<'gcx> {
224+
fn hash_stable<W: StableHasherResult>(&self,
225+
hcx: &mut StableHashingContext<'a>,
226+
hasher: &mut StableHasher<W>) {
227+
mem::discriminant(self).hash_stable(hcx, hasher);
228+
match self {
229+
mir::PlaceBase::Local(local) => {
230+
local.hash_stable(hcx, hasher);
231+
}
232+
mir::PlaceBase::Static(statik) => {
233+
statik.hash_stable(hcx, hasher);
234+
}
235+
mir::PlaceBase::Promoted(promoted) => {
236+
promoted.hash_stable(hcx, hasher);
237+
}
238+
}
239+
}
240+
}
241+
242+
impl_stable_hash_for!(struct mir::NeoPlace<'tcx> { base, elems });
243+
223244
impl<'a, 'gcx, B, V, T> HashStable<StableHashingContext<'a>>
224245
for mir::Projection<'gcx, B, V, T>
225246
where B: HashStable<StableHashingContext<'a>>,
@@ -322,45 +343,45 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Rvalue<'gcx> {
322343
hasher: &mut StableHasher<W>) {
323344
mem::discriminant(self).hash_stable(hcx, hasher);
324345

325-
match *self {
326-
mir::Rvalue::Use(ref operand) => {
346+
match self {
347+
mir::Rvalue::Use(operand) => {
327348
operand.hash_stable(hcx, hasher);
328349
}
329-
mir::Rvalue::Repeat(ref operand, ref val) => {
350+
mir::Rvalue::Repeat(operand, val) => {
330351
operand.hash_stable(hcx, hasher);
331352
val.hash_stable(hcx, hasher);
332353
}
333-
mir::Rvalue::Ref(region, borrow_kind, ref place) => {
354+
mir::Rvalue::Ref(region, borrow_kind, place) => {
334355
region.hash_stable(hcx, hasher);
335356
borrow_kind.hash_stable(hcx, hasher);
336357
place.hash_stable(hcx, hasher);
337358
}
338-
mir::Rvalue::Len(ref place) => {
359+
mir::Rvalue::Len(place) => {
339360
place.hash_stable(hcx, hasher);
340361
}
341-
mir::Rvalue::Cast(cast_kind, ref operand, ty) => {
362+
mir::Rvalue::Cast(cast_kind, operand, ty) => {
342363
cast_kind.hash_stable(hcx, hasher);
343364
operand.hash_stable(hcx, hasher);
344365
ty.hash_stable(hcx, hasher);
345366
}
346-
mir::Rvalue::BinaryOp(op, ref operand1, ref operand2) |
347-
mir::Rvalue::CheckedBinaryOp(op, ref operand1, ref operand2) => {
367+
mir::Rvalue::BinaryOp(op, operand1, operand2) |
368+
mir::Rvalue::CheckedBinaryOp(op, operand1, operand2) => {
348369
op.hash_stable(hcx, hasher);
349370
operand1.hash_stable(hcx, hasher);
350371
operand2.hash_stable(hcx, hasher);
351372
}
352-
mir::Rvalue::UnaryOp(op, ref operand) => {
373+
mir::Rvalue::UnaryOp(op, operand) => {
353374
op.hash_stable(hcx, hasher);
354375
operand.hash_stable(hcx, hasher);
355376
}
356-
mir::Rvalue::Discriminant(ref place) => {
377+
mir::Rvalue::Discriminant(place) => {
357378
place.hash_stable(hcx, hasher);
358379
}
359380
mir::Rvalue::NullaryOp(op, ty) => {
360381
op.hash_stable(hcx, hasher);
361382
ty.hash_stable(hcx, hasher);
362383
}
363-
mir::Rvalue::Aggregate(ref kind, ref operands) => {
384+
mir::Rvalue::Aggregate(kind, operands) => {
364385
kind.hash_stable(hcx, hasher);
365386
operands.hash_stable(hcx, hasher);
366387
}

0 commit comments

Comments
 (0)