Skip to content

Change AdtDef's PartialEq and Hash impls to use DefId #92040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
}

Expand All @@ -126,7 +126,7 @@ impl Eq for AdtDef {}
impl Hash for AdtDef {
#[inline]
fn hash<H: Hasher>(&self, s: &mut H) {
(self as *const AdtDef).hash(s)
self.did.hash(s)
}
}

Expand Down