Skip to content

Commit 94d61d8

Browse files
author
Lukas Markeffsky
committed
add RawList
1 parent fcc477f commit 94d61d8

File tree

3 files changed

+100
-255
lines changed

3 files changed

+100
-255
lines changed

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ macro_rules! slice_interners {
18751875
List::empty()
18761876
} else {
18771877
self.interners.$field.intern_ref(v, || {
1878-
InternedInSet(List::from_arena(&*self.arena, v))
1878+
InternedInSet(List::from_arena(&*self.arena, (), v))
18791879
}).0
18801880
}
18811881
})+

compiler/rustc_middle/src/ty/impls_ty.rs

+5-14
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ use rustc_data_structures::stable_hasher::HashingControls;
1111
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
1212
use rustc_query_system::ich::StableHashingContext;
1313
use std::cell::RefCell;
14+
use std::ptr;
1415

15-
impl<'a, 'tcx, T> HashStable<StableHashingContext<'a>> for &'tcx ty::List<T>
16+
impl<'a, 'tcx, H, T> HashStable<StableHashingContext<'a>> for &'tcx ty::list::RawList<H, T>
1617
where
1718
T: HashStable<StableHashingContext<'a>>,
1819
{
1920
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
2021
thread_local! {
21-
static CACHE: RefCell<FxHashMap<(usize, usize, HashingControls), Fingerprint>> =
22+
static CACHE: RefCell<FxHashMap<(*const (), HashingControls), Fingerprint>> =
2223
RefCell::new(Default::default());
2324
}
2425

2526
let hash = CACHE.with(|cache| {
26-
let key = (self.as_ptr() as usize, self.len(), hcx.hashing_controls());
27+
let key = (ptr::from_ref(*self).cast::<()>(), hcx.hashing_controls());
2728
if let Some(&hash) = cache.borrow().get(&key) {
2829
return hash;
2930
}
@@ -40,7 +41,7 @@ where
4041
}
4142
}
4243

43-
impl<'a, 'tcx, T> ToStableHashKey<StableHashingContext<'a>> for &'tcx ty::List<T>
44+
impl<'a, 'tcx, H, T> ToStableHashKey<StableHashingContext<'a>> for &'tcx ty::list::RawList<H, T>
4445
where
4546
T: HashStable<StableHashingContext<'a>>,
4647
{
@@ -55,16 +56,6 @@ where
5556
}
5657
}
5758

58-
impl<'a, 'tcx, T> HashStable<StableHashingContext<'a>> for &'tcx ty::ListWithCachedTypeInfo<T>
59-
where
60-
T: HashStable<StableHashingContext<'a>>,
61-
{
62-
#[inline]
63-
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
64-
self.as_list().hash_stable(hcx, hasher);
65-
}
66-
}
67-
6859
impl<'a> ToStableHashKey<StableHashingContext<'a>> for SimplifiedType {
6960
type KeyType = Fingerprint;
7061

0 commit comments

Comments
 (0)