Skip to content

Commit e27ca5a

Browse files
committed
Fix some stuff
1 parent 3590961 commit e27ca5a

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ impl<'tcx> OwnerNodes<'tcx> {
739739
}
740740

741741
/// Full information resulting from lowering an AST node.
742-
#[derive(Debug)]
742+
#[derive(Debug, HashStable_Generic)]
743+
#[stable_hasher(no_hash_stable_eq)]
743744
pub struct OwnerInfo<'hir> {
744745
/// Contents of the HIR.
745746
pub nodes: OwnerNodes<'hir>,

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
2828
use crate::ty::util::Discr;
2929
use rustc_ast as ast;
3030
use rustc_attr as attr;
31-
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
3231
use rustc_data_structures::intern::Interned;
33-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
32+
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
33+
use rustc_data_structures::stable_hasher::{HashStable, HashStableEq, StableHasher};
3434
use rustc_data_structures::tagged_ptr::CopyTaggedPtr;
3535
use rustc_hir as hir;
3636
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
@@ -444,7 +444,31 @@ static BOOL_TYS: TyS<'static> = TyS {
444444
outer_exclusive_binder: DebruijnIndex::from_usize(0),
445445
};
446446

447-
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Ty<'tcx> {
447+
impl<'tcx> PartialEq for TyS<'tcx> {
448+
#[inline]
449+
fn eq(&self, other: &TyS<'tcx>) -> bool {
450+
// Pointer equality implies equality (due to the unique contents
451+
// assumption).
452+
ptr::eq(self, other)
453+
}
454+
}
455+
impl<'tcx> Eq for TyS<'tcx> {}
456+
457+
impl<'tcx> HashStableEq for TyS<'tcx> {
458+
fn hash_stable_eq(&self, other: Self) -> bool {
459+
self == other
460+
}
461+
}
462+
463+
impl<'tcx> Hash for TyS<'tcx> {
464+
fn hash<H: Hasher>(&self, s: &mut H) {
465+
// Pointer hashing is sufficient (due to the unique contents
466+
// assumption).
467+
(self as *const TyS<'_>).hash(s)
468+
}
469+
}
470+
471+
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TyS<'tcx> {
448472
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
449473
let TyS {
450474
ref kind,

0 commit comments

Comments
 (0)