From 4233b735317eeb2c09230ae94246f70d1b91f1fa Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 17 Dec 2021 10:18:24 -0500 Subject: [PATCH] Change AdtDef's `PartialEq` and `Hash` impls to use `DefId` --- compiler/rustc_middle/src/ty/adt.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs index 771ce2eb884af..08452585a3f59 100644 --- a/compiler/rustc_middle/src/ty/adt.rs +++ b/compiler/rustc_middle/src/ty/adt.rs @@ -20,7 +20,7 @@ use std::cell::RefCell; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; use std::ops::Range; -use std::{ptr, str}; +use std::str; use super::{ Destructor, FieldDef, GenericPredicates, ReprOptions, Ty, TyCtxt, VariantDef, VariantDiscr, @@ -117,7 +117,7 @@ impl PartialEq for AdtDef { // `AdtDef`s are always interned, and this is part of `TyS` equality. #[inline] fn eq(&self, other: &Self) -> bool { - ptr::eq(self, other) + self.did == other.did } } @@ -126,7 +126,7 @@ impl Eq for AdtDef {} impl Hash for AdtDef { #[inline] fn hash(&self, s: &mut H) { - (self as *const AdtDef).hash(s) + self.did.hash(s) } }