]> git.lizzy.rs Git - rust.git/commitdiff
Monomorphize `AllocType`
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 3 Dec 2018 13:57:41 +0000 (14:57 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 3 Dec 2018 13:57:41 +0000 (14:57 +0100)
src/librustc/ich/impls_ty.rs
src/librustc/mir/interpret/mod.rs

index e6a7c20f7937934374bbae4dcbe84d5810bfcc4f..00ef3dd414bc9e9a4b75094171b38262dc5cdbe8 100644 (file)
@@ -338,7 +338,7 @@ impl<Tag> for enum mir::interpret::Scalar<Tag> [ 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),
index 6ac80d72b1bc4b9ca4f81ee4509e8d3f88a06995..35719e49723ecb21eb2e8ce4a301bdab916c8ac3 100644 (file)
@@ -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<AllocId, AllocType<'tcx, &'tcx Allocation>>,
+    id_to_type: FxHashMap<AllocId, AllocType<'tcx>>,
 
     /// Used to ensure that functions and statics only get one associated AllocId
-    type_interner: FxHashMap<AllocType<'tcx, &'tcx Allocation>, AllocId>,
+    type_interner: FxHashMap<AllocType<'tcx>, 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<AllocType<'tcx, &'tcx Allocation>> {
+    pub fn get(&self, id: AllocId) -> Option<AllocType<'tcx>> {
         self.id_to_type.get(&id).cloned()
     }