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