about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/common.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-05-30 13:05:05 +0200
committerRalf Jung <post@ralfj.de>2019-05-30 13:05:05 +0200
commit41c36fabefbf20351a9c8263a17131e15b19d35a (patch)
treee53c4624e5170180660eee7ff80c7edfd80b0e57 /src/librustc_codegen_llvm/common.rs
parentc28084ac16af4ab594b6860958df140e7c876a13 (diff)
downloadrust-41c36fabefbf20351a9c8263a17131e15b19d35a.tar.gz
rust-41c36fabefbf20351a9c8263a17131e15b19d35a.zip
light refactoring of global AllocMap
* rename AllocKind -> GlobalAlloc. This stores the allocation itself, not just its kind.
* rename the methods that allocate stuff to have consistent names.
Diffstat (limited to 'src/librustc_codegen_llvm/common.rs')
-rw-r--r--src/librustc_codegen_llvm/common.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs
index c713362440d..0b23aac5224 100644
--- a/src/librustc_codegen_llvm/common.rs
+++ b/src/librustc_codegen_llvm/common.rs
@@ -12,7 +12,7 @@ use rustc_codegen_ssa::traits::*;
 
 use crate::consts::const_alloc_to_llvm;
 use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size};
-use rustc::mir::interpret::{Scalar, AllocKind, Allocation};
+use rustc::mir::interpret::{Scalar, GlobalAlloc, Allocation};
 use rustc_codegen_ssa::mir::place::PlaceRef;
 
 use libc::{c_uint, c_char};
@@ -310,7 +310,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             Scalar::Ptr(ptr) => {
                 let alloc_kind = self.tcx.alloc_map.lock().get(ptr.alloc_id);
                 let base_addr = match alloc_kind {
-                    Some(AllocKind::Memory(alloc)) => {
+                    Some(GlobalAlloc::Memory(alloc)) => {
                         let init = const_alloc_to_llvm(self, alloc);
                         if alloc.mutability == Mutability::Mutable {
                             self.static_addr_of_mut(init, alloc.align, None)
@@ -318,10 +318,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                             self.static_addr_of(init, alloc.align, None)
                         }
                     }
-                    Some(AllocKind::Function(fn_instance)) => {
+                    Some(GlobalAlloc::Function(fn_instance)) => {
                         self.get_fn(fn_instance)
                     }
-                    Some(AllocKind::Static(def_id)) => {
+                    Some(GlobalAlloc::Static(def_id)) => {
                         assert!(self.tcx.is_static(def_id));
                         self.get_static(def_id)
                     }