From: Oliver Scherer Date: Mon, 3 Dec 2018 13:57:41 +0000 (+0100) Subject: Monomorphize `AllocType` X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=3074fcb7e301c772cfb2301345cb3ee9d5fe3d4c;p=rust.git Monomorphize `AllocType` --- diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index e6a7c20f793..00ef3dd414b 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -338,7 +338,7 @@ impl for enum mir::interpret::Scalar [ mir::interpret::Scalar ] { ); impl_stable_hash_for!( - impl<'tcx, M> for enum mir::interpret::AllocType<'tcx, M> [ mir::interpret::AllocType ] { + impl<'tcx> for enum mir::interpret::AllocType<'tcx> [ mir::interpret::AllocType ] { Function(instance), Static(def_id), Memory(mem), diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 6ac80d72b1b..35719e49723 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -103,7 +103,7 @@ pub fn specialized_encode_alloc_id< tcx: TyCtxt<'a, 'tcx, 'tcx>, alloc_id: AllocId, ) -> Result<(), E::Error> { - let alloc_type: AllocType<'tcx, &'tcx Allocation> = + let alloc_type: AllocType<'tcx> = tcx.alloc_map.lock().get(alloc_id).expect("no value for AllocId"); match alloc_type { AllocType::Memory(alloc) => { @@ -291,22 +291,22 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } #[derive(Debug, Clone, Eq, PartialEq, Hash, RustcDecodable, RustcEncodable)] -pub enum AllocType<'tcx, M> { +pub enum AllocType<'tcx> { /// The alloc id is used as a function pointer Function(Instance<'tcx>), /// The alloc id points to a "lazy" static variable that did not get computed (yet). /// This is also used to break the cycle in recursive statics. Static(DefId), /// The alloc id points to memory - Memory(M) + Memory(&'tcx Allocation), } pub struct AllocMap<'tcx> { /// Lets you know what an AllocId refers to - id_to_type: FxHashMap>, + id_to_type: FxHashMap>, /// Used to ensure that functions and statics only get one associated AllocId - type_interner: FxHashMap, AllocId>, + type_interner: FxHashMap, AllocId>, /// The AllocId to assign to the next requested id. /// Always incremented, never gets smaller. @@ -336,7 +336,7 @@ pub fn reserve( next } - fn intern(&mut self, alloc_type: AllocType<'tcx, &'tcx Allocation>) -> AllocId { + fn intern(&mut self, alloc_type: AllocType<'tcx>) -> AllocId { if let Some(&alloc_id) = self.type_interner.get(&alloc_type) { return alloc_id; } @@ -354,7 +354,7 @@ pub fn create_fn_alloc(&mut self, instance: Instance<'tcx>) -> AllocId { self.intern(AllocType::Function(instance)) } - pub fn get(&self, id: AllocId) -> Option> { + pub fn get(&self, id: AllocId) -> Option> { self.id_to_type.get(&id).cloned() }