File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed
src/librustc_codegen_llvm Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -423,11 +423,10 @@ fn thin_lto(diag_handler: &Handler,
423423 thin_modules. len ( ) as u32 ,
424424 symbol_white_list. as_ptr ( ) ,
425425 symbol_white_list. len ( ) as u32 ,
426- ) ;
427- if data. is_null ( ) {
428- let msg = "failed to prepare thin LTO context" . to_string ( ) ;
429- return Err ( write:: llvm_err ( & diag_handler, msg) )
430- }
426+ ) . ok_or_else ( || {
427+ write:: llvm_err ( & diag_handler, "failed to prepare thin LTO context" . to_string ( ) )
428+ } ) ?;
429+
431430 let data = ThinData ( data) ;
432431 info ! ( "thin LTO data created" ) ;
433432 timeline. record ( "data" ) ;
@@ -566,15 +565,15 @@ struct ThinShared {
566565 module_names : Vec < CString > ,
567566}
568567
569- struct ThinData ( * mut llvm:: ThinLTOData ) ;
568+ struct ThinData ( & ' static mut llvm:: ThinLTOData ) ;
570569
571570unsafe impl Send for ThinData { }
572571unsafe impl Sync for ThinData { }
573572
574573impl Drop for ThinData {
575574 fn drop ( & mut self ) {
576575 unsafe {
577- llvm:: LLVMRustFreeThinLTOData ( self . 0 ) ;
576+ llvm:: LLVMRustFreeThinLTOData ( & mut * ( self . 0 as * mut _ ) ) ;
578577 }
579578 }
580579}
Original file line number Diff line number Diff line change @@ -1580,24 +1580,24 @@ extern "C" {
15801580 NumModules : c_uint ,
15811581 PreservedSymbols : * const * const c_char ,
15821582 PreservedSymbolsLen : c_uint ,
1583- ) -> * mut ThinLTOData ;
1583+ ) -> Option < & ' static mut ThinLTOData > ;
15841584 pub fn LLVMRustPrepareThinLTORename (
1585- Data : * const ThinLTOData ,
1585+ Data : & ThinLTOData ,
15861586 Module : & Module ,
15871587 ) -> bool ;
15881588 pub fn LLVMRustPrepareThinLTOResolveWeak (
1589- Data : * const ThinLTOData ,
1589+ Data : & ThinLTOData ,
15901590 Module : & Module ,
15911591 ) -> bool ;
15921592 pub fn LLVMRustPrepareThinLTOInternalize (
1593- Data : * const ThinLTOData ,
1593+ Data : & ThinLTOData ,
15941594 Module : & Module ,
15951595 ) -> bool ;
15961596 pub fn LLVMRustPrepareThinLTOImport (
1597- Data : * const ThinLTOData ,
1597+ Data : & ThinLTOData ,
15981598 Module : & Module ,
15991599 ) -> bool ;
1600- pub fn LLVMRustFreeThinLTOData ( Data : * mut ThinLTOData ) ;
1600+ pub fn LLVMRustFreeThinLTOData ( Data : & ' static mut ThinLTOData ) ;
16011601 pub fn LLVMRustParseBitcodeForThinLTO (
16021602 Context : & Context ,
16031603 Data : * const u8 ,
You can’t perform that action at this time.
0 commit comments