Skip to content

Enable upcoming compiler features#401

Merged
kukushechkin merged 1 commit intoapple:mainfrom
kukushechkin:enable-upcoming-compiler-features
Jan 30, 2026
Merged

Enable upcoming compiler features#401
kukushechkin merged 1 commit intoapple:mainfrom
kukushechkin:enable-upcoming-compiler-features

Conversation

@kukushechkin
Copy link
Copy Markdown
Contributor

Enable several upcoming compiler features to make the codebase more explicit in intention:

    // https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md
    // Require `any` for existential types.
    settings.append(.enableUpcomingFeature("ExistentialAny"))

    // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
    settings.append(.enableUpcomingFeature("MemberImportVisibility"))

    // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md
    settings.append(.enableUpcomingFeature("InternalImportsByDefault"))

    // https://docs.swift.org/compiler/documentation/diagnostics/nonisolated-nonsending-by-default/
    settings.append(.enableUpcomingFeature("NonisolatedNonsendingByDefault"))

    // Ensure all public types are explicitly annotated as Sendable or not Sendable.
    settings.append(.unsafeFlags(["-Xfrontend", "-require-explicit-sendable"]))

Motivation:

Sync codebase with the modern practice, get ready for the upcoming features.

Modifications:

  • Compiler flags added for all the existing targets.
  • Imports and access modifiers adjusted.
  • LoggingSystem marked as Sendable

Result:

Codebase is updated with the modern practices.

@kukushechkin kukushechkin added the 🆕 semver/minor Adds new public API. label Jan 16, 2026
@kukushechkin kukushechkin requested review from FranzBusch and removed request for FranzBusch January 16, 2026 17:46
@kukushechkin
Copy link
Copy Markdown
Contributor Author

@FranzBusch removing @preconcurrency in a package supporting 6.0+ is not really a breaking change, or do I miss something?

settings.append(.enableUpcomingFeature("NonisolatedNonsendingByDefault"))

// Ensure all public types are explicitly annotated as Sendable or not Sendable.
settings.append(.unsafeFlags(["-Xfrontend", "-require-explicit-sendable"]))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do this since unsafe flags are not allowed in SemVer stable packages

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not true anymore since 6.2 swiftlang/swift-package-manager#8951 / https://forums.swift.org/t/pitch-disable-checks-for-unsafe-flags-in-swiftpm/80698/27 so if we wanted to we could do so in Package+6.2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added Package@swift-6.1.swift without the .unsafeFlags and the Package.swift now has .unsafeFlags.

@FranzBusch
Copy link
Copy Markdown
Member

@FranzBusch removing @preconcurrency in a package supporting 6.0+ is not really a breaking change, or do I miss something?

There can be other packages that depend on the that have not yet migrated to Swift 6 language mode which would break if we remove the @preconcurrency annotation. We have to keep those around until the next major.

@kukushechkin kukushechkin force-pushed the enable-upcoming-compiler-features branch 2 times, most recently from 56969be to 142f05c Compare January 23, 2026 12:48
sync wi th other packages
@kukushechkin kukushechkin force-pushed the enable-upcoming-compiler-features branch from 0a6f96a to bc66103 Compare January 23, 2026 16:33
@kukushechkin kukushechkin marked this pull request as ready for review January 23, 2026 17:01
@kukushechkin kukushechkin enabled auto-merge (squash) January 26, 2026 11:14
@kukushechkin kukushechkin merged commit 47ef0ec into apple:main Jan 30, 2026
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants