Skip to content

Commit 3074fcb

Browse files
committed
Monomorphize AllocType
1 parent a5e57c8 commit 3074fcb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl_stable_hash_for!(
338338
);
339339

340340
impl_stable_hash_for!(
341-
impl<'tcx, M> for enum mir::interpret::AllocType<'tcx, M> [ mir::interpret::AllocType ] {
341+
impl<'tcx> for enum mir::interpret::AllocType<'tcx> [ mir::interpret::AllocType ] {
342342
Function(instance),
343343
Static(def_id),
344344
Memory(mem),

src/librustc/mir/interpret/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub fn specialized_encode_alloc_id<
103103
tcx: TyCtxt<'a, 'tcx, 'tcx>,
104104
alloc_id: AllocId,
105105
) -> Result<(), E::Error> {
106-
let alloc_type: AllocType<'tcx, &'tcx Allocation> =
106+
let alloc_type: AllocType<'tcx> =
107107
tcx.alloc_map.lock().get(alloc_id).expect("no value for AllocId");
108108
match alloc_type {
109109
AllocType::Memory(alloc) => {
@@ -291,22 +291,22 @@ impl fmt::Display for AllocId {
291291
}
292292

293293
#[derive(Debug, Clone, Eq, PartialEq, Hash, RustcDecodable, RustcEncodable)]
294-
pub enum AllocType<'tcx, M> {
294+
pub enum AllocType<'tcx> {
295295
/// The alloc id is used as a function pointer
296296
Function(Instance<'tcx>),
297297
/// The alloc id points to a "lazy" static variable that did not get computed (yet).
298298
/// This is also used to break the cycle in recursive statics.
299299
Static(DefId),
300300
/// The alloc id points to memory
301-
Memory(M)
301+
Memory(&'tcx Allocation),
302302
}
303303

304304
pub struct AllocMap<'tcx> {
305305
/// Lets you know what an AllocId refers to
306-
id_to_type: FxHashMap<AllocId, AllocType<'tcx, &'tcx Allocation>>,
306+
id_to_type: FxHashMap<AllocId, AllocType<'tcx>>,
307307

308308
/// Used to ensure that functions and statics only get one associated AllocId
309-
type_interner: FxHashMap<AllocType<'tcx, &'tcx Allocation>, AllocId>,
309+
type_interner: FxHashMap<AllocType<'tcx>, AllocId>,
310310

311311
/// The AllocId to assign to the next requested id.
312312
/// Always incremented, never gets smaller.
@@ -336,7 +336,7 @@ impl<'tcx> AllocMap<'tcx> {
336336
next
337337
}
338338

339-
fn intern(&mut self, alloc_type: AllocType<'tcx, &'tcx Allocation>) -> AllocId {
339+
fn intern(&mut self, alloc_type: AllocType<'tcx>) -> AllocId {
340340
if let Some(&alloc_id) = self.type_interner.get(&alloc_type) {
341341
return alloc_id;
342342
}
@@ -354,7 +354,7 @@ impl<'tcx> AllocMap<'tcx> {
354354
self.intern(AllocType::Function(instance))
355355
}
356356

357-
pub fn get(&self, id: AllocId) -> Option<AllocType<'tcx, &'tcx Allocation>> {
357+
pub fn get(&self, id: AllocId) -> Option<AllocType<'tcx>> {
358358
self.id_to_type.get(&id).cloned()
359359
}
360360

0 commit comments

Comments
 (0)