diff options
| author | Antoni Boucher <bouanto@zoho.com> | 2023-10-09 16:45:46 -0400 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2023-10-09 17:13:35 -0400 |
| commit | 06c5ac47615b5e87d2a6575690aa26d6b8b3d352 (patch) | |
| tree | a0c56607b513bfab72f361f283bad2440b336c5d /compiler/rustc_codegen_gcc | |
| parent | 2cbac9c636eda3c260d4eb5b533db2f3252b4f65 (diff) | |
| download | rust-06c5ac47615b5e87d2a6575690aa26d6b8b3d352.tar.gz rust-06c5ac47615b5e87d2a6575690aa26d6b8b3d352.zip | |
Use IntoDynSyncSend
Diffstat (limited to 'compiler/rustc_codegen_gcc')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/lib.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index fe233930560..9c18fc4a0dc 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -73,6 +73,7 @@ mod type_; mod type_of; use std::any::Any; +use std::fmt::Debug; use std::sync::Arc; use std::sync::Mutex; #[cfg(not(feature="master"))] @@ -93,6 +94,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule}; use rustc_codegen_ssa::target_features::supported_target_features; use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::sync::IntoDynSyncSend; use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods}; use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage}; use rustc_fluent_macro::fluent_messages; @@ -138,9 +140,15 @@ impl TargetInfo { } } -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct LockedTargetInfo { - info: Arc<Mutex<TargetInfo>>, + info: Arc<Mutex<IntoDynSyncSend<TargetInfo>>>, +} + +impl Debug for LockedTargetInfo { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.info.lock().expect("lock").fmt(formatter) + } } impl LockedTargetInfo { @@ -174,7 +182,7 @@ impl CodegenBackend for GccCodegenBackend { context.add_command_line_option(&format!("-march={}", target_cpu)); } - *self.target_info.info.lock().expect("lock") = context.get_target_info(); + **self.target_info.info.lock().expect("lock") = context.get_target_info(); } #[cfg(feature="master")] @@ -340,12 +348,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> { let info = { // Check whether the target supports 128-bit integers. let context = Context::default(); - Arc::new(Mutex::new(context.get_target_info())) + Arc::new(Mutex::new(IntoDynSyncSend(context.get_target_info()))) }; #[cfg(not(feature="master"))] - let info = Arc::new(Mutex::new(TargetInfo { + let info = Arc::new(Mutex::new(IntoDynSyncSend(TargetInfo { supports_128bit_integers: AtomicBool::new(false), - })); + }))); Box::new(GccCodegenBackend { target_info: LockedTargetInfo { info }, |
