@@ -7,6 +7,7 @@ use rustc_middle::bug;
77use rustc_middle:: ty:: TyCtxt ;
88use rustc_session:: config:: { DebugInfo , OomStrategy } ;
99
10+ use crate :: common:: AsCCharPtr ;
1011use crate :: llvm:: { self , Context , False , Module , True , Type } ;
1112use crate :: { ModuleLlvm , attributes, debuginfo} ;
1213
@@ -76,14 +77,14 @@ pub(crate) unsafe fn codegen(
7677 unsafe {
7778 // __rust_alloc_error_handler_should_panic
7879 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) ;
8081 llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
8182 let val = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
8283 let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
8384 llvm:: LLVMSetInitializer ( ll_g, llval) ;
8485
8586 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) ;
8788 llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
8889 let llval = llvm:: LLVMConstInt ( i8, 0 , False ) ;
8990 llvm:: LLVMSetInitializer ( ll_g, llval) ;
@@ -115,7 +116,7 @@ fn create_wrapper_function(
115116 ) ;
116117 let llfn = llvm:: LLVMRustGetOrInsertFunction (
117118 llmod,
118- from_name. as_ptr ( ) . cast ( ) ,
119+ from_name. as_c_char_ptr ( ) ,
119120 from_name. len ( ) ,
120121 ty,
121122 ) ;
@@ -137,7 +138,7 @@ fn create_wrapper_function(
137138 }
138139
139140 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) ;
141142 if let Some ( no_return) = no_return {
142143 // -> ! DIFlagNoReturn
143144 attributes:: apply_to_llfn ( callee, llvm:: AttributePlace :: Function , & [ no_return] ) ;
0 commit comments