Closed finestructure closed 3 weeks ago
This fixes all remaining Swift6 warnings (and one deprecation warning related to LogHandler).
The warnings were of the kind Converting non-sendable function value and raised for our request handers:
Converting non-sendable function value
app.get(SiteURL.package(.key, .key, .none).pathComponents, use: PackageController.show).excludeFromOpenAPI()
A known fix for this was to write
app.get(SiteURL.package(.key, .key, .none).pathComponents, use: { try await PackageController.show(req: $0) }).excludeFromOpenAPI()
which is quite a bit of extra noise. We were hoping the compiler should infer @Sendable automatically to make this change unnecessary.
@Sendable
However, a simpler fix is to annotate the request handlers as @Sendable. See also https://forums.swift.org/t/vapor-and-sendable-route-handlers/71613/3
This clears all the noise now and should get us warning free.
This fixes all remaining Swift6 warnings (and one deprecation warning related to LogHandler).
The warnings were of the kind
Converting non-sendable function value
and raised for our request handers:A known fix for this was to write
which is quite a bit of extra noise. We were hoping the compiler should infer
@Sendable
automatically to make this change unnecessary.However, a simpler fix is to annotate the request handlers as
@Sendable
. See also https://forums.swift.org/t/vapor-and-sendable-route-handlers/71613/3This clears all the noise now and should get us warning free.