Skip to content

[Swift in WebKit] Promote VariableNeverMutated and UnusedImportAccess to errors - #77427

Open
rr-codes wants to merge 1 commit into
WebKit:mainfrom
rr-codes:eng/Swift-in-WebKit-Promote-VariableNeverMutated-and-UnusedImportAccess-to-errors
Open

rr-codes wants to merge 1 commit into
WebKit:mainfrom
rr-codes:eng/Swift-in-WebKit-Promote-VariableNeverMutated-and-UnusedImportAccess-to-errors

Conversation

@rr-codes

@rr-codes rr-codes commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

a8d48f5

[Swift in WebKit] Promote VariableNeverMutated and UnusedImportAccess to errors
https://bugs.webkit.org/show_bug.cgi?id=327982
rdar://190336417

Reviewed by NOBODY (OOPS!).

Treat the VariableNeverMutated and UnusedImportAccess Swift diagnostic groups
as errors instead of warnings.

In the Xcode build, both are only errors with SDKs that ship Swift 6.4 or later,
since the build still has to support Swift 6.3. With Swift 6.3, the existing
violations can't be fixed (rdar://170907318) or suppressed (`@diagnose` is
unavailable).

In the CMake build, this also fixes NoUsage and NoUseUnstructuredThrowingTask
never being enforced. They were gated on CMAKE_Swift_LANGUAGE_VERSION, which is
never set, and WebKitSwiftFlags.cmake is included before enable_language(Swift),
so no Swift version variable is available at that point anyway. The gate kept
unknown warning groups on older toolchains from failing the build, but that
can no longer happen since Swift warnings are no longer treated as errors, so
remove it to match Xcode.

* Configurations/CommonBase.xcconfig:
* Source/WebGPU/WebGPU/CommandEncoder.swift:
(WebGPU.beginRenderPass(_:)):
* Source/WebKit/UIProcess/API/Swift/WebPage+ImmersiveEnvironment.swift:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift:
* Source/WebKit/_WebKit_SwiftUI/CrossImportOverlay.swift:
* Source/cmake/WebKitSwiftFlags.cmake:

a8d48f5

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ⏳ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 loading-orange 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ⏳ 🧪 api-mac-debug ✅ 🧪 jsc-wpe
loading 🧪 jsc-x86-64 loading 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ⏳ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@rr-codes rr-codes self-assigned this Oct 18, 2026
@rr-codes rr-codes added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Oct 18, 2026
… to errors

https://bugs.webkit.org/show_bug.cgi?id=327982
rdar://190336417

Reviewed by NOBODY (OOPS!).

Treat the VariableNeverMutated and UnusedImportAccess Swift diagnostic groups
as errors instead of warnings.

In the Xcode build, both are only errors with SDKs that ship Swift 6.4 or later,
since the build still has to support Swift 6.3. With Swift 6.3, the existing
violations can't be fixed (rdar://170907318) or suppressed (`@diagnose` is
unavailable).

In the CMake build, this also fixes NoUsage and NoUseUnstructuredThrowingTask
never being enforced. They were gated on CMAKE_Swift_LANGUAGE_VERSION, which is
never set, and WebKitSwiftFlags.cmake is included before enable_language(Swift),
so no Swift version variable is available at that point anyway. The gate kept
unknown warning groups on older toolchains from failing the build, but that
can no longer happen since Swift warnings are no longer treated as errors, so
remove it to match Xcode.

* Configurations/CommonBase.xcconfig:
* Source/WebGPU/WebGPU/CommandEncoder.swift:
(WebGPU.beginRenderPass(_:)):
* Source/WebKit/UIProcess/API/Swift/WebPage+ImmersiveEnvironment.swift:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift:
* Source/WebKit/_WebKit_SwiftUI/CrossImportOverlay.swift:
* Source/cmake/WebKitSwiftFlags.cmake:
@rr-codes
rr-codes force-pushed the eng/Swift-in-WebKit-Promote-VariableNeverMutated-and-UnusedImportAccess-to-errors branch from c0f5ddb to a8d48f5 Compare October 18, 2026 04:47

@zakariaridouh zakariaridouh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants