Skip to content

allTests generates sendability warnings in Swift 6 snapshots on Linux #7556

@Lukasa

Description

@Lukasa

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI.

Description

When building the tests for swift-asn1 with -Xswiftc -strict-concurrency=complete and a recent Swift 6 snapshot on Linux, we get a bunch of warnings from allTests:

################################################################
#                                                              #
# Swift Nightly Docker Image                                   #
# Tag: swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-30-a             #
#                                                              #
################################################################

Expected behavior

Clean compile of the tests.

Actual behavior

Each of the allTests directives generates a warning:

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:6:16: warning: static property '__allTests__ASN1StringTests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1StringTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
  4 | fileprivate extension ASN1StringTests {
  5 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
  6 |     static let __allTests__ASN1StringTests = [
    |                |- warning: static property '__allTests__ASN1StringTests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1StringTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__ASN1StringTests' to a global actor, or conform '[(String, (ASN1StringTests) -> () throws -> ())]' to 'Sendable'
  7 |         ("testBMPStringContiguousBytes", testBMPStringContiguousBytes),
  8 |         ("testBMPStringEncoding", testBMPStringEncoding),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:32:16: warning: static property '__allTests__ASN1Tests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1Tests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
 30 | fileprivate extension ASN1Tests {
 31 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
 32 |     static let __allTests__ASN1Tests = [
    |                |- warning: static property '__allTests__ASN1Tests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1Tests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__ASN1Tests' to a global actor, or conform '[(String, (ASN1Tests) -> () throws -> ())]' to 'Sendable'
 33 |         ("testASN1PKCS8PrivateKeyP256", testASN1PKCS8PrivateKeyP256),
 34 |         ("testASN1PKCS8PrivateKeyP384", testASN1PKCS8PrivateKeyP384),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:103:16: warning: static property '__allTests__GeneralizedTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (GeneralizedTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
101 | fileprivate extension GeneralizedTimeTests {
102 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
103 |     static let __allTests__GeneralizedTimeTests = [
    |                |- warning: static property '__allTests__GeneralizedTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (GeneralizedTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__GeneralizedTimeTests' to a global actor, or conform '[(String, (GeneralizedTimeTests) -> () throws -> ())]' to 'Sendable'
104 |         ("testComparisons", testComparisons),
105 |         ("testCreatingOutOfBoundsValuesViaInitFails", testCreatingOutOfBoundsValuesViaInitFails),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:114:16: warning: static property '__allTests__UTCTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (UTCTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
112 | fileprivate extension UTCTimeTests {
113 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
114 |     static let __allTests__UTCTimeTests = [
    |                |- warning: static property '__allTests__UTCTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (UTCTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__UTCTimeTests' to a global actor, or conform '[(String, (UTCTimeTests) -> () throws -> ())]' to 'Sendable'
115 |         ("testComparisons", testComparisons)
116 |     ]
/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:6:16: warning: static property '__allTests__ASN1StringTests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1StringTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
  4 | fileprivate extension ASN1StringTests {
  5 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
  6 |     static let __allTests__ASN1StringTests = [
    |                |- warning: static property '__allTests__ASN1StringTests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1StringTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__ASN1StringTests' to a global actor, or conform '[(String, (ASN1StringTests) -> () throws -> ())]' to 'Sendable'
  7 |         ("testBMPStringContiguousBytes", testBMPStringContiguousBytes),
  8 |         ("testBMPStringEncoding", testBMPStringEncoding),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:32:16: warning: static property '__allTests__ASN1Tests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1Tests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
 30 | fileprivate extension ASN1Tests {
 31 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
 32 |     static let __allTests__ASN1Tests = [
    |                |- warning: static property '__allTests__ASN1Tests' is not concurrency-safe because non-'Sendable' type '[(String, (ASN1Tests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__ASN1Tests' to a global actor, or conform '[(String, (ASN1Tests) -> () throws -> ())]' to 'Sendable'
 33 |         ("testASN1PKCS8PrivateKeyP256", testASN1PKCS8PrivateKeyP256),
 34 |         ("testASN1PKCS8PrivateKeyP384", testASN1PKCS8PrivateKeyP384),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:103:16: warning: static property '__allTests__GeneralizedTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (GeneralizedTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
101 | fileprivate extension GeneralizedTimeTests {
102 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
103 |     static let __allTests__GeneralizedTimeTests = [
    |                |- warning: static property '__allTests__GeneralizedTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (GeneralizedTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__GeneralizedTimeTests' to a global actor, or conform '[(String, (GeneralizedTimeTests) -> () throws -> ())]' to 'Sendable'
104 |         ("testComparisons", testComparisons),
105 |         ("testCreatingOutOfBoundsValuesViaInitFails", testCreatingOutOfBoundsValuesViaInitFails),

/code/.build/aarch64-unknown-linux-gnu/debug/swift-asn1PackageDiscoveredTests.derived/SwiftASN1Tests.swift:114:16: warning: static property '__allTests__UTCTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (UTCTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
112 | fileprivate extension UTCTimeTests {
113 |     @available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
114 |     static let __allTests__UTCTimeTests = [
    |                |- warning: static property '__allTests__UTCTimeTests' is not concurrency-safe because non-'Sendable' type '[(String, (UTCTimeTests) -> () throws -> ())]' may have shared mutable state; this is an error in the Swift 6 language mode
    |                `- note: isolate '__allTests__UTCTimeTests' to a global actor, or conform '[(String, (UTCTimeTests) -> () throws -> ())]' to 'Sendable'
115 |         ("testComparisons", testComparisons)
116 |     ]

Steps to reproduce

  1. git clone https://github.com/apple/swift-asn1
  2. cd swift-asn1
  3. swift test -Xswiftc -strict-concurrency=complete

Swift Package Manager version/commit hash

Whatever shipped in that docker image

Swift & OS version (output of swift --version ; uname -a)

# swift --version
Swift version 6.0-dev (LLVM 7b8e6346027d2b1, Swift 763421cee31dc8f)
Target: aarch64-unknown-linux-gnu
# uname -a
Linux 7329a66171f8 6.6.16-linuxkit #1 SMP Fri Feb 16 11:54:02 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions