@@ -7,6 +7,7 @@ use rustc_middle::bug;
7
7
use rustc_middle:: ty:: TyCtxt ;
8
8
use rustc_session:: config:: { DebugInfo , OomStrategy } ;
9
9
10
+ use crate :: common:: AsCCharPtr ;
10
11
use crate :: llvm:: { self , Context , False , Module , True , Type } ;
11
12
use crate :: { ModuleLlvm , attributes, debuginfo} ;
12
13
@@ -76,14 +77,14 @@ pub(crate) unsafe fn codegen(
76
77
unsafe {
77
78
// __rust_alloc_error_handler_should_panic
78
79
let name = OomStrategy :: SYMBOL ;
79
- let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
80
+ let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_c_char_ptr ( ) , name. len ( ) , i8) ;
80
81
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
81
82
let val = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
82
83
let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
83
84
llvm:: LLVMSetInitializer ( ll_g, llval) ;
84
85
85
86
let name = NO_ALLOC_SHIM_IS_UNSTABLE ;
86
- let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
87
+ let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_c_char_ptr ( ) , name. len ( ) , i8) ;
87
88
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
88
89
let llval = llvm:: LLVMConstInt ( i8, 0 , False ) ;
89
90
llvm:: LLVMSetInitializer ( ll_g, llval) ;
@@ -115,7 +116,7 @@ fn create_wrapper_function(
115
116
) ;
116
117
let llfn = llvm:: LLVMRustGetOrInsertFunction (
117
118
llmod,
118
- from_name. as_ptr ( ) . cast ( ) ,
119
+ from_name. as_c_char_ptr ( ) ,
119
120
from_name. len ( ) ,
120
121
ty,
121
122
) ;
@@ -137,7 +138,7 @@ fn create_wrapper_function(
137
138
}
138
139
139
140
let callee =
140
- llvm:: LLVMRustGetOrInsertFunction ( llmod, to_name. as_ptr ( ) . cast ( ) , to_name. len ( ) , ty) ;
141
+ llvm:: LLVMRustGetOrInsertFunction ( llmod, to_name. as_c_char_ptr ( ) , to_name. len ( ) , ty) ;
141
142
if let Some ( no_return) = no_return {
142
143
// -> ! DIFlagNoReturn
143
144
attributes:: apply_to_llfn ( callee, llvm:: AttributePlace :: Function , & [ no_return] ) ;
0 commit comments