From 82cc0eeec1a000b8f2b87a070ea807bdd41f44bf Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Tue, 26 Aug 2025 18:55:41 +0300 Subject: Ensure the coordinator thread terminates first --- compiler/rustc_codegen_ssa/src/back/write.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_codegen_ssa/src') diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 9f22859ba81..0d766d2704b 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1957,10 +1957,10 @@ impl Drop for Coordinator { pub struct OngoingCodegen { pub backend: B, pub crate_info: CrateInfo, - pub codegen_worker_receive: Receiver, - pub shared_emitter_main: SharedEmitterMain, pub output_filenames: Arc, pub coordinator: Coordinator, + pub codegen_worker_receive: Receiver, + pub shared_emitter_main: SharedEmitterMain, } impl OngoingCodegen { -- cgit 1.4.1-3-g733a5 From dd07459096beddf523b86a7ef03e4703390a7319 Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Tue, 26 Aug 2025 19:18:39 +0300 Subject: Comment on intentional field order --- compiler/rustc_codegen_ssa/src/back/write.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compiler/rustc_codegen_ssa/src') diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 0d766d2704b..8586615f7c7 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1958,6 +1958,9 @@ pub struct OngoingCodegen { pub backend: B, pub crate_info: CrateInfo, pub output_filenames: Arc, + // 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, pub codegen_worker_receive: Receiver, pub shared_emitter_main: SharedEmitterMain, -- cgit 1.4.1-3-g733a5