]> git.proxmox.com Git - rustc.git/blame - src/librustc/ich/impls_mir.rs
New upstream version 1.28.0~beta.14+dfsg1
[rustc.git] / src / librustc / ich / impls_mir.rs
CommitLineData
cc61c64b
XL
1// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11//! This module contains `HashStable` implementations for various MIR data
12//! types in no particular order.
13
14use ich::StableHashingContext;
15use mir;
16use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
17 StableHasherResult};
18use std::mem;
19
ea8adc8c 20impl_stable_hash_for!(struct mir::GeneratorLayout<'tcx> { fields });
cc61c64b
XL
21impl_stable_hash_for!(struct mir::SourceInfo { span, scope });
22impl_stable_hash_for!(enum mir::Mutability { Mut, Not });
cc61c64b 23impl_stable_hash_for!(enum mir::LocalKind { Var, Temp, Arg, ReturnPointer });
7cac9316
XL
24impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
25 mutability,
26 ty,
27 name,
28 source_info,
94b46f34 29 visibility_scope,
ea8adc8c 30 internal,
7cac9316
XL
31 is_user_variable
32});
ff7c6d11 33impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref, mutability });
cc61c64b 34impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
ff7c6d11 35impl_stable_hash_for!(struct mir::UnsafetyViolation { source_info, description, kind });
ea8adc8c 36impl_stable_hash_for!(struct mir::UnsafetyCheckResult { violations, unsafe_blocks });
7cac9316 37
0531ce1d 38impl<'a> HashStable<StableHashingContext<'a>>
2c00a5a8
XL
39for mir::BorrowKind {
40 #[inline]
41 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 42 hcx: &mut StableHashingContext<'a>,
2c00a5a8
XL
43 hasher: &mut StableHasher<W>) {
44 mem::discriminant(self).hash_stable(hcx, hasher);
45
46 match *self {
47 mir::BorrowKind::Shared |
48 mir::BorrowKind::Unique => {}
49 mir::BorrowKind::Mut { allow_two_phase_borrow } => {
50 allow_two_phase_borrow.hash_stable(hcx, hasher);
51 }
52 }
53 }
54}
55
56
0531ce1d 57impl<'a> HashStable<StableHashingContext<'a>>
ff7c6d11 58for mir::UnsafetyViolationKind {
7cac9316
XL
59 #[inline]
60 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 61 hcx: &mut StableHashingContext<'a>,
7cac9316 62 hasher: &mut StableHasher<W>) {
7cac9316 63
ff7c6d11
XL
64 mem::discriminant(self).hash_stable(hcx, hasher);
65
66 match *self {
67 mir::UnsafetyViolationKind::General => {}
68 mir::UnsafetyViolationKind::ExternStatic(lint_node_id) |
69 mir::UnsafetyViolationKind::BorrowPacked(lint_node_id) => {
70 lint_node_id.hash_stable(hcx, hasher);
7cac9316 71 }
7cac9316 72
ff7c6d11 73 }
7cac9316
XL
74 }
75}
76
ff7c6d11
XL
77impl_stable_hash_for!(struct mir::Terminator<'tcx> {
78 kind,
79 source_info
80});
81
0531ce1d
XL
82impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for mir::ClearCrossCrate<T>
83 where T: HashStable<StableHashingContext<'a>>
ea8adc8c
XL
84{
85 #[inline]
86 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 87 hcx: &mut StableHashingContext<'a>,
ea8adc8c
XL
88 hasher: &mut StableHasher<W>) {
89 mem::discriminant(self).hash_stable(hcx, hasher);
90 match *self {
ff7c6d11
XL
91 mir::ClearCrossCrate::Clear => {}
92 mir::ClearCrossCrate::Set(ref value) => {
ea8adc8c
XL
93 value.hash_stable(hcx, hasher);
94 }
95 }
96 }
97}
cc61c64b 98
0531ce1d 99impl<'a> HashStable<StableHashingContext<'a>> for mir::Local {
cc61c64b
XL
100 #[inline]
101 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 102 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
103 hasher: &mut StableHasher<W>) {
104 use rustc_data_structures::indexed_vec::Idx;
105 self.index().hash_stable(hcx, hasher);
106 }
107}
108
0531ce1d 109impl<'a> HashStable<StableHashingContext<'a>> for mir::BasicBlock {
cc61c64b
XL
110 #[inline]
111 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 112 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
113 hasher: &mut StableHasher<W>) {
114 use rustc_data_structures::indexed_vec::Idx;
115 self.index().hash_stable(hcx, hasher);
116 }
117}
118
0531ce1d 119impl<'a> HashStable<StableHashingContext<'a>> for mir::Field {
cc61c64b
XL
120 #[inline]
121 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 122 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
123 hasher: &mut StableHasher<W>) {
124 use rustc_data_structures::indexed_vec::Idx;
125 self.index().hash_stable(hcx, hasher);
126 }
127}
128
0531ce1d 129impl<'a> HashStable<StableHashingContext<'a>>
94b46f34 130for mir::SourceScope {
cc61c64b
XL
131 #[inline]
132 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 133 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
134 hasher: &mut StableHasher<W>) {
135 use rustc_data_structures::indexed_vec::Idx;
136 self.index().hash_stable(hcx, hasher);
137 }
138}
139
0531ce1d 140impl<'a> HashStable<StableHashingContext<'a>> for mir::Promoted {
cc61c64b
XL
141 #[inline]
142 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 143 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
144 hasher: &mut StableHasher<W>) {
145 use rustc_data_structures::indexed_vec::Idx;
146 self.index().hash_stable(hcx, hasher);
147 }
148}
149
0531ce1d 150impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
3b2f2976 151for mir::TerminatorKind<'gcx> {
cc61c64b 152 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 153 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
154 hasher: &mut StableHasher<W>) {
155 mem::discriminant(self).hash_stable(hcx, hasher);
156
157 match *self {
158 mir::TerminatorKind::Goto { ref target } => {
159 target.hash_stable(hcx, hasher);
160 }
161 mir::TerminatorKind::SwitchInt { ref discr,
162 switch_ty,
163 ref values,
164 ref targets } => {
165 discr.hash_stable(hcx, hasher);
166 switch_ty.hash_stable(hcx, hasher);
167 values.hash_stable(hcx, hasher);
168 targets.hash_stable(hcx, hasher);
169 }
170 mir::TerminatorKind::Resume |
ff7c6d11 171 mir::TerminatorKind::Abort |
cc61c64b 172 mir::TerminatorKind::Return |
ea8adc8c 173 mir::TerminatorKind::GeneratorDrop |
cc61c64b
XL
174 mir::TerminatorKind::Unreachable => {}
175 mir::TerminatorKind::Drop { ref location, target, unwind } => {
176 location.hash_stable(hcx, hasher);
177 target.hash_stable(hcx, hasher);
178 unwind.hash_stable(hcx, hasher);
179 }
180 mir::TerminatorKind::DropAndReplace { ref location,
181 ref value,
182 target,
183 unwind, } => {
184 location.hash_stable(hcx, hasher);
185 value.hash_stable(hcx, hasher);
186 target.hash_stable(hcx, hasher);
187 unwind.hash_stable(hcx, hasher);
188 }
ea8adc8c
XL
189 mir::TerminatorKind::Yield { ref value,
190 resume,
191 drop } => {
192 value.hash_stable(hcx, hasher);
193 resume.hash_stable(hcx, hasher);
194 drop.hash_stable(hcx, hasher);
195 }
cc61c64b
XL
196 mir::TerminatorKind::Call { ref func,
197 ref args,
198 ref destination,
199 cleanup } => {
200 func.hash_stable(hcx, hasher);
201 args.hash_stable(hcx, hasher);
202 destination.hash_stable(hcx, hasher);
203 cleanup.hash_stable(hcx, hasher);
204 }
205 mir::TerminatorKind::Assert { ref cond,
206 expected,
207 ref msg,
208 target,
209 cleanup } => {
210 cond.hash_stable(hcx, hasher);
211 expected.hash_stable(hcx, hasher);
212 msg.hash_stable(hcx, hasher);
213 target.hash_stable(hcx, hasher);
214 cleanup.hash_stable(hcx, hasher);
215 }
abe05a73
XL
216 mir::TerminatorKind::FalseEdges { ref real_target, ref imaginary_targets } => {
217 real_target.hash_stable(hcx, hasher);
218 for target in imaginary_targets {
219 target.hash_stable(hcx, hasher);
220 }
221 }
2c00a5a8
XL
222 mir::TerminatorKind::FalseUnwind { ref real_target, ref unwind } => {
223 real_target.hash_stable(hcx, hasher);
224 unwind.hash_stable(hcx, hasher);
225 }
cc61c64b
XL
226 }
227 }
228}
229
cc61c64b
XL
230impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind });
231
0531ce1d 232impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
3b2f2976 233for mir::StatementKind<'gcx> {
cc61c64b 234 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 235 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
236 hasher: &mut StableHasher<W>) {
237 mem::discriminant(self).hash_stable(hcx, hasher);
238
239 match *self {
ff7c6d11
XL
240 mir::StatementKind::Assign(ref place, ref rvalue) => {
241 place.hash_stable(hcx, hasher);
cc61c64b
XL
242 rvalue.hash_stable(hcx, hasher);
243 }
94b46f34
XL
244 mir::StatementKind::ReadForMatch(ref place) => {
245 place.hash_stable(hcx, hasher);
246 }
ff7c6d11
XL
247 mir::StatementKind::SetDiscriminant { ref place, variant_index } => {
248 place.hash_stable(hcx, hasher);
cc61c64b
XL
249 variant_index.hash_stable(hcx, hasher);
250 }
ff7c6d11
XL
251 mir::StatementKind::StorageLive(ref place) |
252 mir::StatementKind::StorageDead(ref place) => {
253 place.hash_stable(hcx, hasher);
cc61c64b 254 }
ea8adc8c
XL
255 mir::StatementKind::EndRegion(ref region_scope) => {
256 region_scope.hash_stable(hcx, hasher);
3b2f2976 257 }
ff7c6d11 258 mir::StatementKind::Validate(ref op, ref places) => {
3b2f2976 259 op.hash_stable(hcx, hasher);
ff7c6d11 260 places.hash_stable(hcx, hasher);
041b39d2 261 }
0531ce1d
XL
262 mir::StatementKind::UserAssertTy(ref c_ty, ref local) => {
263 c_ty.hash_stable(hcx, hasher);
264 local.hash_stable(hcx, hasher);
265 }
cc61c64b
XL
266 mir::StatementKind::Nop => {}
267 mir::StatementKind::InlineAsm { ref asm, ref outputs, ref inputs } => {
268 asm.hash_stable(hcx, hasher);
269 outputs.hash_stable(hcx, hasher);
270 inputs.hash_stable(hcx, hasher);
271 }
272 }
273 }
274}
275
0531ce1d 276impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>>
3b2f2976 277 for mir::ValidationOperand<'gcx, T>
0531ce1d 278 where T: HashStable<StableHashingContext<'a>>
3b2f2976
XL
279{
280 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 281 hcx: &mut StableHashingContext<'a>,
3b2f2976
XL
282 hasher: &mut StableHasher<W>)
283 {
ff7c6d11 284 self.place.hash_stable(hcx, hasher);
3b2f2976
XL
285 self.ty.hash_stable(hcx, hasher);
286 self.re.hash_stable(hcx, hasher);
287 self.mutbl.hash_stable(hcx, hasher);
288 }
289}
290
ea8adc8c 291impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) });
3b2f2976 292
0531ce1d 293impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Place<'gcx> {
cc61c64b 294 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 295 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
296 hasher: &mut StableHasher<W>) {
297 mem::discriminant(self).hash_stable(hcx, hasher);
298 match *self {
ff7c6d11 299 mir::Place::Local(ref local) => {
cc61c64b
XL
300 local.hash_stable(hcx, hasher);
301 }
ff7c6d11 302 mir::Place::Static(ref statik) => {
cc61c64b
XL
303 statik.hash_stable(hcx, hasher);
304 }
ff7c6d11
XL
305 mir::Place::Projection(ref place_projection) => {
306 place_projection.hash_stable(hcx, hasher);
cc61c64b
XL
307 }
308 }
309 }
310}
311
0531ce1d 312impl<'a, 'gcx, B, V, T> HashStable<StableHashingContext<'a>>
3b2f2976 313for mir::Projection<'gcx, B, V, T>
0531ce1d
XL
314 where B: HashStable<StableHashingContext<'a>>,
315 V: HashStable<StableHashingContext<'a>>,
316 T: HashStable<StableHashingContext<'a>>
cc61c64b
XL
317{
318 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 319 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
320 hasher: &mut StableHasher<W>) {
321 let mir::Projection {
322 ref base,
323 ref elem,
324 } = *self;
325
326 base.hash_stable(hcx, hasher);
327 elem.hash_stable(hcx, hasher);
328 }
329}
330
0531ce1d 331impl<'a, 'gcx, V, T> HashStable<StableHashingContext<'a>>
3b2f2976 332for mir::ProjectionElem<'gcx, V, T>
0531ce1d
XL
333 where V: HashStable<StableHashingContext<'a>>,
334 T: HashStable<StableHashingContext<'a>>
cc61c64b
XL
335{
336 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 337 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
338 hasher: &mut StableHasher<W>) {
339 mem::discriminant(self).hash_stable(hcx, hasher);
340 match *self {
341 mir::ProjectionElem::Deref => {}
3b2f2976 342 mir::ProjectionElem::Field(field, ref ty) => {
cc61c64b
XL
343 field.hash_stable(hcx, hasher);
344 ty.hash_stable(hcx, hasher);
345 }
346 mir::ProjectionElem::Index(ref value) => {
347 value.hash_stable(hcx, hasher);
348 }
349 mir::ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
350 offset.hash_stable(hcx, hasher);
351 min_length.hash_stable(hcx, hasher);
352 from_end.hash_stable(hcx, hasher);
353 }
354 mir::ProjectionElem::Subslice { from, to } => {
355 from.hash_stable(hcx, hasher);
356 to.hash_stable(hcx, hasher);
357 }
358 mir::ProjectionElem::Downcast(adt_def, variant) => {
359 adt_def.hash_stable(hcx, hasher);
360 variant.hash_stable(hcx, hasher);
361 }
362 }
363 }
364}
365
94b46f34
XL
366impl_stable_hash_for!(struct mir::SourceScopeData { span, parent_scope });
367impl_stable_hash_for!(struct mir::SourceScopeLocalData {
ea8adc8c
XL
368 lint_root, safety
369});
cc61c64b 370
0531ce1d 371impl<'a> HashStable<StableHashingContext<'a>> for mir::Safety {
cc61c64b 372 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 373 hcx: &mut StableHashingContext<'a>,
ea8adc8c
XL
374 hasher: &mut StableHasher<W>) {
375 mem::discriminant(self).hash_stable(hcx, hasher);
376
377 match *self {
378 mir::Safety::Safe |
379 mir::Safety::BuiltinUnsafe |
380 mir::Safety::FnUnsafe => {}
381 mir::Safety::ExplicitUnsafe(node_id) => {
382 node_id.hash_stable(hcx, hasher);
383 }
384 }
385 }
386}
387
0531ce1d 388impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Operand<'gcx> {
ea8adc8c 389 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 390 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
391 hasher: &mut StableHasher<W>) {
392 mem::discriminant(self).hash_stable(hcx, hasher);
393
394 match *self {
ff7c6d11
XL
395 mir::Operand::Copy(ref place) => {
396 place.hash_stable(hcx, hasher);
397 }
398 mir::Operand::Move(ref place) => {
399 place.hash_stable(hcx, hasher);
cc61c64b
XL
400 }
401 mir::Operand::Constant(ref constant) => {
402 constant.hash_stable(hcx, hasher);
403 }
404 }
405 }
406}
407
0531ce1d 408impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Rvalue<'gcx> {
cc61c64b 409 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 410 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
411 hasher: &mut StableHasher<W>) {
412 mem::discriminant(self).hash_stable(hcx, hasher);
413
414 match *self {
415 mir::Rvalue::Use(ref operand) => {
416 operand.hash_stable(hcx, hasher);
417 }
418 mir::Rvalue::Repeat(ref operand, ref val) => {
419 operand.hash_stable(hcx, hasher);
420 val.hash_stable(hcx, hasher);
421 }
ff7c6d11 422 mir::Rvalue::Ref(region, borrow_kind, ref place) => {
cc61c64b
XL
423 region.hash_stable(hcx, hasher);
424 borrow_kind.hash_stable(hcx, hasher);
ff7c6d11 425 place.hash_stable(hcx, hasher);
cc61c64b 426 }
ff7c6d11
XL
427 mir::Rvalue::Len(ref place) => {
428 place.hash_stable(hcx, hasher);
cc61c64b
XL
429 }
430 mir::Rvalue::Cast(cast_kind, ref operand, ty) => {
431 cast_kind.hash_stable(hcx, hasher);
432 operand.hash_stable(hcx, hasher);
433 ty.hash_stable(hcx, hasher);
434 }
435 mir::Rvalue::BinaryOp(op, ref operand1, ref operand2) |
436 mir::Rvalue::CheckedBinaryOp(op, ref operand1, ref operand2) => {
437 op.hash_stable(hcx, hasher);
438 operand1.hash_stable(hcx, hasher);
439 operand2.hash_stable(hcx, hasher);
440 }
441 mir::Rvalue::UnaryOp(op, ref operand) => {
442 op.hash_stable(hcx, hasher);
443 operand.hash_stable(hcx, hasher);
444 }
ff7c6d11
XL
445 mir::Rvalue::Discriminant(ref place) => {
446 place.hash_stable(hcx, hasher);
cc61c64b 447 }
7cac9316
XL
448 mir::Rvalue::NullaryOp(op, ty) => {
449 op.hash_stable(hcx, hasher);
cc61c64b
XL
450 ty.hash_stable(hcx, hasher);
451 }
452 mir::Rvalue::Aggregate(ref kind, ref operands) => {
453 kind.hash_stable(hcx, hasher);
454 operands.hash_stable(hcx, hasher);
455 }
456 }
457 }
458}
459
460impl_stable_hash_for!(enum mir::CastKind {
461 Misc,
462 ReifyFnPointer,
463 ClosureFnPointer,
464 UnsafeFnPointer,
465 Unsize
466});
467
0531ce1d 468impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
3b2f2976 469for mir::AggregateKind<'gcx> {
cc61c64b 470 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 471 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
472 hasher: &mut StableHasher<W>) {
473 mem::discriminant(self).hash_stable(hcx, hasher);
474 match *self {
475 mir::AggregateKind::Tuple => {}
476 mir::AggregateKind::Array(t) => {
477 t.hash_stable(hcx, hasher);
478 }
479 mir::AggregateKind::Adt(adt_def, idx, substs, active_field) => {
480 adt_def.hash_stable(hcx, hasher);
481 idx.hash_stable(hcx, hasher);
482 substs.hash_stable(hcx, hasher);
483 active_field.hash_stable(hcx, hasher);
484 }
485 mir::AggregateKind::Closure(def_id, ref substs) => {
486 def_id.hash_stable(hcx, hasher);
487 substs.hash_stable(hcx, hasher);
488 }
94b46f34 489 mir::AggregateKind::Generator(def_id, ref substs, movability) => {
ea8adc8c
XL
490 def_id.hash_stable(hcx, hasher);
491 substs.hash_stable(hcx, hasher);
94b46f34 492 movability.hash_stable(hcx, hasher);
ea8adc8c 493 }
cc61c64b
XL
494 }
495 }
496}
497
498impl_stable_hash_for!(enum mir::BinOp {
499 Add,
500 Sub,
501 Mul,
502 Div,
503 Rem,
504 BitXor,
505 BitAnd,
506 BitOr,
507 Shl,
508 Shr,
509 Eq,
510 Lt,
511 Le,
512 Ne,
513 Ge,
7cac9316
XL
514 Gt,
515 Offset
cc61c64b
XL
516});
517
518impl_stable_hash_for!(enum mir::UnOp {
519 Not,
520 Neg
521});
522
7cac9316
XL
523impl_stable_hash_for!(enum mir::NullOp {
524 Box,
525 SizeOf
526});
cc61c64b
XL
527
528impl_stable_hash_for!(struct mir::Constant<'tcx> { span, ty, literal });
529
0531ce1d 530impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Literal<'gcx> {
cc61c64b 531 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 532 hcx: &mut StableHashingContext<'a>,
cc61c64b
XL
533 hasher: &mut StableHasher<W>) {
534 mem::discriminant(self).hash_stable(hcx, hasher);
535 match *self {
cc61c64b
XL
536 mir::Literal::Value { ref value } => {
537 value.hash_stable(hcx, hasher);
538 }
539 mir::Literal::Promoted { index } => {
540 index.hash_stable(hcx, hasher);
541 }
542 }
543 }
544}
545
546impl_stable_hash_for!(struct mir::Location { block, statement_index });
ff7c6d11 547
83c7162d
XL
548impl_stable_hash_for!(struct mir::BorrowCheckResult<'tcx> {
549 closure_requirements,
550 used_mut_upvars
551});
552
ff7c6d11
XL
553impl_stable_hash_for!(struct mir::ClosureRegionRequirements<'tcx> {
554 num_external_vids,
555 outlives_requirements
556});
557
558impl_stable_hash_for!(struct mir::ClosureOutlivesRequirement<'tcx> {
559 subject,
560 outlived_free_region,
561 blame_span
562});
563
0531ce1d 564impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::ClosureOutlivesSubject<'gcx> {
ff7c6d11 565 fn hash_stable<W: StableHasherResult>(&self,
0531ce1d 566 hcx: &mut StableHashingContext<'a>,
ff7c6d11
XL
567 hasher: &mut StableHasher<W>) {
568 mem::discriminant(self).hash_stable(hcx, hasher);
569 match *self {
570 mir::ClosureOutlivesSubject::Ty(ref ty) => {
571 ty.hash_stable(hcx, hasher);
572 }
573 mir::ClosureOutlivesSubject::Region(ref region) => {
574 region.hash_stable(hcx, hasher);
575 }
576 }
577 }
578}
0531ce1d
XL
579
580impl_stable_hash_for!(struct mir::interpret::GlobalId<'tcx> { instance, promoted });