Skip to content

Instantly share code, notes, and snippets.

@davidtwco
Last active August 14, 2020 22:43
Show Gist options
  • Save davidtwco/bb6ce85cafa5f971153560a1a405be05 to your computer and use it in GitHub Desktop.
Save davidtwco/bb6ce85cafa5f971153560a1a405be05 to your computer and use it in GitHub Desktop.
Attempt to make reveal other issues resulting from root cause of rust-lang/rust#75255.
diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs
index 6798addb8aa..8d8018982c9 100644
--- a/src/librustc_middle/ty/mod.rs
+++ b/src/librustc_middle/ty/mod.rs
@@ -645,7 +645,30 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TyS<'tcx> {
outer_exclusive_binder: _,
} = *self;
- kind.hash_stable(hcx, hasher);
+ match kind {
+ ty::Closure(def_id, substs) => {
+ ::std::mem::discriminant(kind).hash_stable(hcx, hasher);
+ def_id.hash_stable(hcx, hasher);
+ let substs = substs.as_closure();
+ substs.kind_ty().hash_stable(hcx, hasher);
+ substs.parent_substs().hash_stable(hcx, hasher);
+ substs.sig_as_fn_ptr_ty().hash_stable(hcx, hasher);
+ substs.tupled_upvars_ty().hash_stable(hcx, hasher);
+ }
+ ty::Generator(def_id, substs, movability) => {
+ ::std::mem::discriminant(kind).hash_stable(hcx, hasher);
+ def_id.hash_stable(hcx, hasher);
+ movability.hash_stable(hcx, hasher);
+ let substs = substs.as_generator();
+ substs.parent_substs().hash_stable(hcx, hasher);
+ substs.resume_ty().hash_stable(hcx, hasher);
+ substs.return_ty().hash_stable(hcx, hasher);
+ substs.witness().hash_stable(hcx, hasher);
+ substs.yield_ty().hash_stable(hcx, hasher);
+ substs.tupled_upvars_ty().hash_stable(hcx, hasher);
+ }
+ _ => kind.hash_stable(hcx, hasher),
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment