about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-27 21:51:54 -0400
committerGitHub <noreply@github.com>2025-08-27 21:51:54 -0400
commit5527156d92b4b9756bad1257cd3bc0ce31a720c7 (patch)
tree706b985df7251182338276fbd0df412e5e32d969 /compiler/rustc_codegen_ssa/src
parent64d0d1d6684db3abcf561cfb1fbbc5dd38d03097 (diff)
parentdd07459096beddf523b86a7ef03e4703390a7319 (diff)
downloadrust-5527156d92b4b9756bad1257cd3bc0ce31a720c7.tar.gz
rust-5527156d92b4b9756bad1257cd3bc0ce31a720c7.zip
Rollup merge of #145894 - zetanumbers:issue-142949, r=WaffleLapkin
Ensure the coordinator thread terminates before its channels drop

Fixes rust-lang/rust#142949

Explanation: https://github.com/rust-lang/rust/issues/142949#issuecomment-3224573185
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 9f22859ba81..8586615f7c7 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -1957,10 +1957,13 @@ impl<B: ExtraBackendMethods> Drop for Coordinator<B> {
 pub struct OngoingCodegen<B: ExtraBackendMethods> {
     pub backend: B,
     pub crate_info: CrateInfo,
-    pub codegen_worker_receive: Receiver<CguMessage>,
-    pub shared_emitter_main: SharedEmitterMain,
     pub output_filenames: Arc<OutputFilenames>,
+    // Field order below is intended to terminate the coordinator thread before two fields below
+    // drop and prematurely close channels used by coordinator thread. See `Coordinator`'s
+    // `Drop` implementation for more info.
     pub coordinator: Coordinator<B>,
+    pub codegen_worker_receive: Receiver<CguMessage>,
+    pub shared_emitter_main: SharedEmitterMain,
 }
 
 impl<B: ExtraBackendMethods> OngoingCodegen<B> {