mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
We can not tell the compiler that we can safely return `sending` results, because fetched values are in the same region as the `db` argument, according to SE-0414 (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0414-region-based-isolation.md#rules-for-merging-isolation-regions). ``` class NotSendable { init() { } } func fetchNotSendable(_ db: Database) -> NotSendable { fatalError() } func notOK<T>(_ make: (Database) -> sending T) { } func ok<T>(_ make: () -> sending T) { } func usage() { ok { NotSendable() } // Returning a task-isolated 'NotSendable' value as a 'sending' result // risks causing data races. notOK { db in fetchNotSendable(db) } } ``` Various attempts at modifying all fetching methods so that they have a `sending` return value have failed.