@@ -73,6 +73,7 @@ mod type_;
7373mod type_of;
7474
7575use std:: any:: Any ;
76+ use std:: fmt:: Debug ;
7677use std:: sync:: Arc ;
7778use std:: sync:: Mutex ;
7879#[ cfg( not( feature="master" ) ) ]
@@ -93,6 +94,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig,
9394use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule } ;
9495use rustc_codegen_ssa:: target_features:: supported_target_features;
9596use rustc_data_structures:: fx:: FxIndexMap ;
97+ use rustc_data_structures:: sync:: IntoDynSyncSend ;
9698use rustc_codegen_ssa:: traits:: { CodegenBackend , ExtraBackendMethods , ThinBufferMethods , WriteBackendMethods } ;
9799use rustc_errors:: { DiagnosticMessage , ErrorGuaranteed , Handler , SubdiagnosticMessage } ;
98100use rustc_fluent_macro:: fluent_messages;
@@ -138,9 +140,15 @@ impl TargetInfo {
138140 }
139141}
140142
141- #[ derive( Clone , Debug ) ]
143+ #[ derive( Clone ) ]
142144pub 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+ }
144152}
145153
146154impl LockedTargetInfo {
@@ -174,7 +182,7 @@ impl CodegenBackend for GccCodegenBackend {
174182 context. add_command_line_option ( & format ! ( "-march={}" , target_cpu) ) ;
175183 }
176184
177- * self . target_info . info . lock ( ) . expect ( "lock" ) = context. get_target_info ( ) ;
185+ * * self . target_info . info . lock ( ) . expect ( "lock" ) = context. get_target_info ( ) ;
178186 }
179187
180188 #[ cfg( feature="master" ) ]
@@ -340,12 +348,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
340348 let info = {
341349 // Check whether the target supports 128-bit integers.
342350 let context = Context :: default ( ) ;
343- Arc :: new ( Mutex :: new ( context. get_target_info ( ) ) )
351+ Arc :: new ( Mutex :: new ( IntoDynSyncSend ( context. get_target_info ( ) ) ) )
344352 } ;
345353 #[ cfg( not( feature="master" ) ) ]
346- let info = Arc :: new ( Mutex :: new ( TargetInfo {
354+ let info = Arc :: new ( Mutex :: new ( IntoDynSyncSend ( TargetInfo {
347355 supports_128bit_integers : AtomicBool :: new ( false ) ,
348- } ) ) ;
356+ } ) ) ) ;
349357
350358 Box :: new ( GccCodegenBackend {
351359 target_info : LockedTargetInfo { info } ,
0 commit comments