diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index f9850a08afe..fd13421835c 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -312,7 +312,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { if layout.value == layout::Pointer { unsafe { llvm::LLVMConstIntToPtr(llval, llty) } } else { - self.static_bitcast(llval, llty) + self.const_bitcast(llval, llty) } }, Scalar::Ptr(ptr) => { @@ -336,14 +336,14 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { None => bug!("missing allocation {:?}", ptr.alloc_id), }; let llval = unsafe { llvm::LLVMConstInBoundsGEP( - self.static_bitcast(base_addr, self.type_i8p()), + self.const_bitcast(base_addr, self.type_i8p()), &self.const_usize(ptr.offset.bytes()), 1, ) }; if layout.value != layout::Pointer { unsafe { llvm::LLVMConstPtrToInt(llval, llty) } } else { - self.static_bitcast(llval, llty) + self.const_bitcast(llval, llty) } } } @@ -359,11 +359,11 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { let base_addr = self.static_addr_of(init, layout.align.abi, None); let llval = unsafe { llvm::LLVMConstInBoundsGEP( - self.static_bitcast(base_addr, self.type_i8p()), + self.const_bitcast(base_addr, self.type_i8p()), &self.const_usize(offset.bytes()), 1, )}; - let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self))); + let llval = self.const_bitcast(llval, self.type_ptr_to(layout.llvm_type(self))); PlaceRef::new_sized(llval, layout, alloc.align) } diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 676d182dbac..576a49a13dd 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -172,7 +172,7 @@ pub fn ptrcast(val: &'ll Value, ty: &'ll Type) -> &'ll Value { } impl CodegenCx<'ll, 'tcx> { - crate fn static_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { + crate fn const_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { unsafe { llvm::LLVMConstBitCast(val, ty) }