pub use codec::*;
pub use sty::*;
+/// Needed so we can use #[derive(HashStable_Generic)]
+pub trait HashStableContext {}
+
pub trait Interner {
type AdtDef: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
type SubstsRef: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
/// is the outer fn.
///
/// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index
+ #[derive(HashStable_Generic)]
pub struct DebruijnIndex {
DEBUG_FORMAT = "DebruijnIndex({})",
const INNERMOST = 0,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-#[derive(Encodable, Decodable)]
+#[derive(Encodable, Decodable, HashStable_Generic)]
pub enum IntTy {
Isize,
I8,
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Debug)]
-#[derive(Encodable, Decodable)]
+#[derive(Encodable, Decodable, HashStable_Generic)]
pub enum UintTy {
Usize,
U8,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-#[derive(Encodable, Decodable)]
+#[derive(Encodable, Decodable, HashStable_Generic)]
pub enum FloatTy {
F32,
F64,
}
}
-#[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash)]
+#[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash, HashStable_Generic)]
#[rustc_pass_by_value]
pub enum Variance {
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
}
}
-impl<CTX> HashStable<CTX> for DebruijnIndex {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- self.as_u32().hash_stable(ctx, hasher);
- }
-}
-
-impl<CTX> HashStable<CTX> for IntTy {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- discriminant(self).hash_stable(ctx, hasher);
- }
-}
-
-impl<CTX> HashStable<CTX> for UintTy {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- discriminant(self).hash_stable(ctx, hasher);
- }
-}
-
-impl<CTX> HashStable<CTX> for FloatTy {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- discriminant(self).hash_stable(ctx, hasher);
- }
-}
-
impl<CTX> HashStable<CTX> for InferTy {
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
use InferTy::*;
}
}
-impl<CTX> HashStable<CTX> for Variance {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- discriminant(self).hash_stable(ctx, hasher);
- }
-}
-
impl fmt::Debug for IntVarValue {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
/// declared, but a type name in a non-zero universe is a placeholder
/// type -- an idealized representative of "types in general" that we
/// use for checking generic functions.
+ #[derive(HashStable_Generic)]
pub struct UniverseIndex {
DEBUG_FORMAT = "U{}",
}
self.private < other.private
}
}
-
-impl<CTX> HashStable<CTX> for UniverseIndex {
- fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
- self.private.hash_stable(ctx, hasher);
- }
-}