Skip to content

Commit e3db6dc

Browse files
committed
Get queries sort of compiling
1 parent e27ca5a commit e3db6dc

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

compiler/rustc_data_structures/src/stable_hasher.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,14 @@ impl<T1: HashStableEq, T2: HashStableEq> HashStableEq for (T1, T2) {
311311
}
312312
}
313313

314+
impl<T1: HashStableEq, T2: HashStableEq, T3: HashStableEq> HashStableEq for (T1, T2, T3) {
315+
fn hash_stable_eq(&self, other: &Self) -> bool {
316+
self.0.hash_stable_eq(&other.0) && self.1.hash_stable_eq(&other.1)
317+
&& self.2.hash_stable_eq(&other.2)
318+
}
319+
}
320+
321+
314322
impl<T1: HashStable<CTX>, CTX> HashStable<CTX> for (T1,) {
315323
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
316324
let (ref _0,) = *self;

compiler/rustc_middle/src/ty/list.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::arena::Arena;
22
use rustc_serialize::{Encodable, Encoder};
3+
use rustc_data_structures::stable_hasher::HashStableEq;
34
use std::alloc::Layout;
45
use std::cmp::Ordering;
56
use std::fmt;
@@ -134,6 +135,13 @@ impl<T: PartialEq> PartialEq for List<T> {
134135
}
135136
}
136137

138+
impl<T: HashStableEq> HashStableEq for List<T> {
139+
fn hash_stable_eq(&self, other: &Self) -> bool {
140+
// FIXME - is this right?
141+
self == other
142+
}
143+
}
144+
137145
impl<T: Eq> Eq for List<T> {}
138146

139147
impl<T> Ord for List<T>

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,12 @@ static_assert_size!(PredicateS<'_>, 56);
513513
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
514514
pub struct Predicate<'tcx>(Interned<'tcx, PredicateS<'tcx>>);
515515

516+
impl<'tcx> HashStableEq for Predicate<'tcx> {
517+
fn hash_stable_eq(&self, other: &Self) -> bool {
518+
self == other
519+
}
520+
}
521+
516522
impl<'tcx> Predicate<'tcx> {
517523
/// Gets the inner `Binder<'tcx, PredicateKind<'tcx>>`.
518524
#[inline]
@@ -1289,7 +1295,7 @@ impl WithOptConstParam<DefId> {
12891295
/// When type checking, we use the `ParamEnv` to track
12901296
/// details about the set of where-clauses that are in scope at this
12911297
/// particular point.
1292-
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
1298+
#[derive(Copy, Clone, Hash, PartialEq, Eq, HashStableEq)]
12931299
pub struct ParamEnv<'tcx> {
12941300
/// This packs both caller bounds and the reveal enum into one pointer.
12951301
///
@@ -1524,7 +1530,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
15241530
}
15251531
}
15261532

1527-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TypeFoldable)]
1533+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TypeFoldable, HashStableEq)]
15281534
pub struct ParamEnvAnd<'tcx, T> {
15291535
pub param_env: ParamEnv<'tcx>,
15301536
pub value: T,

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ pub enum BoundVariableKind {
10741074
/// e.g., `liberate_late_bound_regions`).
10751075
///
10761076
/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
1077-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
1077+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, HashStableEq)]
10781078
pub struct Binder<'tcx, T>(T, &'tcx List<BoundVariableKind>);
10791079

10801080
impl<'tcx, T> Binder<'tcx, T>

compiler/rustc_middle/src/ty/subst.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::ty::{self, Lift, List, ParamConst, Ty, TyCtxt};
88

99
use rustc_data_structures::intern::Interned;
1010
use rustc_hir::def_id::DefId;
11-
use rustc_macros::HashStable;
11+
use rustc_macros::{HashStable, HashStableEq};
1212
use rustc_serialize::{self, Decodable, Encodable};
1313
use rustc_span::{Span, DUMMY_SP};
1414
use smallvec::SmallVec;
@@ -29,7 +29,7 @@ use std::ops::ControlFlow;
2929
///
3030
/// Note: the `PartialEq`, `Eq` and `Hash` derives are only valid because `Ty`,
3131
/// `Region` and `Const` are all interned.
32-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
32+
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStableEq)]
3333
pub struct GenericArg<'tcx> {
3434
ptr: NonZeroUsize,
3535
marker: PhantomData<(Ty<'tcx>, ty::Region<'tcx>, ty::Const<'tcx>)>,

0 commit comments

Comments
 (0)