From e9e56e28d396a440cd81785a068cbbf0e6a610a7 Mon Sep 17 00:00:00 2001 From: Brendan Szymanski Date: Wed, 12 Aug 2026 21:45:03 -0400 Subject: [PATCH] Declare MainExecutor conformance explicitly for GLibMainExecutor swift run/build failed on this toolchain (stock swift.org 6.3.3 aarch64 Linux) with: GLibMainExecutor.swift:227: error: value of type 'GLibMainExecutor' does not conform to specified type 'MainExecutor' despite the class already implementing every method MainExecutor requires (enqueue, run, runUntil, stop) via its separate RunLoopExecutor and SerialExecutor conformances. Root cause: Swift protocol refinement is one-directional. MainExecutor : RunLoopExecutor, SerialExecutor adds no requirements of its own, but conforming to the two parent protocols separately does not implicitly satisfy the refined protocol - the existential conversion to 'any MainExecutor' needs an explicit conformance declaration for MainExecutor itself, confirmed with a minimal repro against the stdlib's private _Concurrency interface. Fix: add 'extension GLibMainExecutor: MainExecutor {}' (no new members needed - the class already satisfies every requirement), scoped inside the existing '#if canImport(Glibc)' block. Kept off Darwin deliberately: MainExecutor carries a much higher Darwin '@available' floor than this package targets, and GLibMainExecutor is only ever installed as the process main executor on Linux (DarwinMainQueuePump is the Apple equivalent) - on Darwin it is used solely as a plain SerialExecutor for individual actors, which does not require MainExecutor conformance. Verified: 'swift build' and 'swift test' both clean (286/286 tests) in this package standalone, and a full 'swift build' of Luminate against this checkout via 'swift package edit' succeeds end to end. --- Sources/Portico/MainLoop/GLibMainExecutor.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/Portico/MainLoop/GLibMainExecutor.swift b/Sources/Portico/MainLoop/GLibMainExecutor.swift index a6d350a..790423f 100644 --- a/Sources/Portico/MainLoop/GLibMainExecutor.swift +++ b/Sources/Portico/MainLoop/GLibMainExecutor.swift @@ -216,6 +216,18 @@ nonisolated func portico_executor_destroy_notify(_ data: UnsafeMutableRawPointer } #if canImport(Glibc) + +/// `MainExecutor` refines `RunLoopExecutor & SerialExecutor` without adding +/// further requirements, but Swift protocol refinement is one-directional: +/// conforming to the two parent protocols separately does not implicitly +/// satisfy the refined protocol, so the existential conversion to +/// `any MainExecutor` below needs this explicit (requirement-free) +/// conformance declaration. Scoped to Linux because `MainExecutor` carries a +/// high Darwin `@available` floor that `GLibMainExecutor` should not +/// inherit on Apple platforms, where it is used only as a plain +/// `SerialExecutor` and never installed as the process main executor. +extension GLibMainExecutor: MainExecutor {} + // MARK: - Factory /// Installs ``GLibMainExecutor`` as the process main executor via the