Skip to content

Commit 4233b73

Browse files
committed
Change AdtDef's PartialEq and Hash impls to use DefId
1 parent 2595d03 commit 4233b73

File tree

1 file changed

+3
-3
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+3
-3
lines changed

compiler/rustc_middle/src/ty/adt.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::cell::RefCell;
2020
use std::cmp::Ordering;
2121
use std::hash::{Hash, Hasher};
2222
use std::ops::Range;
23-
use std::{ptr, str};
23+
use std::str;
2424

2525
use super::{
2626
Destructor, FieldDef, GenericPredicates, ReprOptions, Ty, TyCtxt, VariantDef, VariantDiscr,
@@ -117,7 +117,7 @@ impl PartialEq for AdtDef {
117117
// `AdtDef`s are always interned, and this is part of `TyS` equality.
118118
#[inline]
119119
fn eq(&self, other: &Self) -> bool {
120-
ptr::eq(self, other)
120+
self.did == other.did
121121
}
122122
}
123123

@@ -126,7 +126,7 @@ impl Eq for AdtDef {}
126126
impl Hash for AdtDef {
127127
#[inline]
128128
fn hash<H: Hasher>(&self, s: &mut H) {
129-
(self as *const AdtDef).hash(s)
129+
self.did.hash(s)
130130
}
131131
}
132132

0 commit comments

Comments
 (0)