File tree 2 files changed +12
-13
lines changed
src/librustc_codegen_llvm
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,
423
423
thin_modules. len ( ) as u32 ,
424
424
symbol_white_list. as_ptr ( ) ,
425
425
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
+
431
430
let data = ThinData ( data) ;
432
431
info ! ( "thin LTO data created" ) ;
433
432
timeline. record ( "data" ) ;
@@ -566,15 +565,15 @@ struct ThinShared {
566
565
module_names : Vec < CString > ,
567
566
}
568
567
569
- struct ThinData ( * mut llvm:: ThinLTOData ) ;
568
+ struct ThinData ( & ' static mut llvm:: ThinLTOData ) ;
570
569
571
570
unsafe impl Send for ThinData { }
572
571
unsafe impl Sync for ThinData { }
573
572
574
573
impl Drop for ThinData {
575
574
fn drop ( & mut self ) {
576
575
unsafe {
577
- llvm:: LLVMRustFreeThinLTOData ( self . 0 ) ;
576
+ llvm:: LLVMRustFreeThinLTOData ( & mut * ( self . 0 as * mut _ ) ) ;
578
577
}
579
578
}
580
579
}
Original file line number Diff line number Diff line change @@ -1580,24 +1580,24 @@ extern "C" {
1580
1580
NumModules : c_uint ,
1581
1581
PreservedSymbols : * const * const c_char ,
1582
1582
PreservedSymbolsLen : c_uint ,
1583
- ) -> * mut ThinLTOData ;
1583
+ ) -> Option < & ' static mut ThinLTOData > ;
1584
1584
pub fn LLVMRustPrepareThinLTORename (
1585
- Data : * const ThinLTOData ,
1585
+ Data : & ThinLTOData ,
1586
1586
Module : & Module ,
1587
1587
) -> bool ;
1588
1588
pub fn LLVMRustPrepareThinLTOResolveWeak (
1589
- Data : * const ThinLTOData ,
1589
+ Data : & ThinLTOData ,
1590
1590
Module : & Module ,
1591
1591
) -> bool ;
1592
1592
pub fn LLVMRustPrepareThinLTOInternalize (
1593
- Data : * const ThinLTOData ,
1593
+ Data : & ThinLTOData ,
1594
1594
Module : & Module ,
1595
1595
) -> bool ;
1596
1596
pub fn LLVMRustPrepareThinLTOImport (
1597
- Data : * const ThinLTOData ,
1597
+ Data : & ThinLTOData ,
1598
1598
Module : & Module ,
1599
1599
) -> bool ;
1600
- pub fn LLVMRustFreeThinLTOData ( Data : * mut ThinLTOData ) ;
1600
+ pub fn LLVMRustFreeThinLTOData ( Data : & ' static mut ThinLTOData ) ;
1601
1601
pub fn LLVMRustParseBitcodeForThinLTO (
1602
1602
Context : & Context ,
1603
1603
Data : * const u8 ,
You can’t perform that action at this time.
0 commit comments