Skip to content

Commit 06c5ac4

Browse files
committed
Use IntoDynSyncSend
1 parent 2cbac9c commit 06c5ac4

File tree

1 file changed

+14
-6
lines changed
  • compiler/rustc_codegen_gcc/src

1 file changed

+14
-6
lines changed

compiler/rustc_codegen_gcc/src/lib.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ mod type_;
7373
mod type_of;
7474

7575
use std::any::Any;
76+
use std::fmt::Debug;
7677
use std::sync::Arc;
7778
use std::sync::Mutex;
7879
#[cfg(not(feature="master"))]
@@ -93,6 +94,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig,
9394
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
9495
use rustc_codegen_ssa::target_features::supported_target_features;
9596
use rustc_data_structures::fx::FxIndexMap;
97+
use rustc_data_structures::sync::IntoDynSyncSend;
9698
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
9799
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
98100
use rustc_fluent_macro::fluent_messages;
@@ -138,9 +140,15 @@ impl TargetInfo {
138140
}
139141
}
140142

141-
#[derive(Clone, Debug)]
143+
#[derive(Clone)]
142144
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+
}
144152
}
145153

146154
impl 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

Comments
 (0)