@@ -73,6 +73,7 @@ mod type_;
73
73
mod type_of;
74
74
75
75
use std:: any:: Any ;
76
+ use std:: fmt:: Debug ;
76
77
use std:: sync:: Arc ;
77
78
use std:: sync:: Mutex ;
78
79
#[ cfg( not( feature="master" ) ) ]
@@ -93,6 +94,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig,
93
94
use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule } ;
94
95
use rustc_codegen_ssa:: target_features:: supported_target_features;
95
96
use rustc_data_structures:: fx:: FxIndexMap ;
97
+ use rustc_data_structures:: sync:: IntoDynSyncSend ;
96
98
use rustc_codegen_ssa:: traits:: { CodegenBackend , ExtraBackendMethods , ThinBufferMethods , WriteBackendMethods } ;
97
99
use rustc_errors:: { DiagnosticMessage , ErrorGuaranteed , Handler , SubdiagnosticMessage } ;
98
100
use rustc_fluent_macro:: fluent_messages;
@@ -138,9 +140,15 @@ impl TargetInfo {
138
140
}
139
141
}
140
142
141
- #[ derive( Clone , Debug ) ]
143
+ #[ derive( Clone ) ]
142
144
pub struct LockedTargetInfo {
143
- info : Arc < Mutex < TargetInfo > > ,
145
+ info : Arc < Mutex < IntoDynSyncSend < TargetInfo > > > ,
146
+ }
147
+
148
+ impl Debug for LockedTargetInfo {
149
+ fn fmt ( & self , formatter : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
150
+ self . info . lock ( ) . expect ( "lock" ) . fmt ( formatter)
151
+ }
144
152
}
145
153
146
154
impl LockedTargetInfo {
@@ -174,7 +182,7 @@ impl CodegenBackend for GccCodegenBackend {
174
182
context. add_command_line_option ( & format ! ( "-march={}" , target_cpu) ) ;
175
183
}
176
184
177
- * self . target_info . info . lock ( ) . expect ( "lock" ) = context. get_target_info ( ) ;
185
+ * * self . target_info . info . lock ( ) . expect ( "lock" ) = context. get_target_info ( ) ;
178
186
}
179
187
180
188
#[ cfg( feature="master" ) ]
@@ -340,12 +348,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
340
348
let info = {
341
349
// Check whether the target supports 128-bit integers.
342
350
let context = Context :: default ( ) ;
343
- Arc :: new ( Mutex :: new ( context. get_target_info ( ) ) )
351
+ Arc :: new ( Mutex :: new ( IntoDynSyncSend ( context. get_target_info ( ) ) ) )
344
352
} ;
345
353
#[ cfg( not( feature="master" ) ) ]
346
- let info = Arc :: new ( Mutex :: new ( TargetInfo {
354
+ let info = Arc :: new ( Mutex :: new ( IntoDynSyncSend ( TargetInfo {
347
355
supports_128bit_integers : AtomicBool :: new ( false ) ,
348
- } ) ) ;
356
+ } ) ) ) ;
349
357
350
358
Box :: new ( GccCodegenBackend {
351
359
target_info : LockedTargetInfo { info } ,
0 commit comments