swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.14k stars 104 forks source link

Fix `Sendable` checking #240

Closed stevapple closed 2 years ago

stevapple commented 2 years ago

Current state:

Sources/AWSLambdaRuntimeCore/LambdaContext.swift:28:20: error: stored property 'logger' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'Logger'
        public let logger: Logger
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:34:20: error: stored property 'eventLoop' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'EventLoop'
        public let eventLoop: EventLoop
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:37:20: error: stored property 'allocator' of 'Sendable'-conforming struct 'InitializationContext' has non-sendable type 'ByteBufferAllocator'
        public let allocator: ByteBufferAllocator
                   ^
Sources/AWSLambdaRuntimeCore/LambdaContext.swift:98:17: error: stored property 'storage' of 'Sendable'-conforming struct 'LambdaContext' has non-sendable type 'LambdaContext._Storage'
    private var storage: _Storage
                ^

We’re waiting for SwiftNIO and SwiftLog to fully support Sendable, meanwhile the design of LambdaContext should be adapted for Sendable.


WIP: Fix Sendable checking to pass nightly CI.

Motivation:

Add necessary Sendable conformance according to Swift Concurrency adoption guidelines for Swift Server Libraries (swift-server/guides#70).

Modifications:

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

swift-server-bot commented 2 years ago

Can one of the admins verify this patch?

stevapple commented 2 years ago

I have only added necessary Sandable conformances for passing the compiler’s check. If there’s other type/protocol that should also conform to Sendable please let me know.

fabianfett commented 2 years ago

@swift-server-bot test this please