Skip to content

Commit 2187b82

Browse files
authored
Merge branch 'swiftlang:main' into issue-72199
2 parents c178abb + d12cb84 commit 2187b82

File tree

1,726 files changed

+46400
-22752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,726 files changed

+46400
-22752
lines changed

.github/CODEOWNERS

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@
88

99
# TODO: /.clang-format
1010

11-
/.clang-tidy @egorzhdan
11+
/.clang-tidy @egorzhdan
1212

13-
# TODO: /.dir-locals.el
13+
/.dir-locals.el @al45tair
14+
/.editorconfig @hamishknight
1415
# TODO: /.flake8
15-
# TODO: /.gitattributes
16+
/.gitattributes @shahmishal
1617

1718
# .github
1819
/.github/ @shahmishal
1920
/.github/CODEOWNERS @AnthonyLatsis @shahmishal
20-
/.github/ISSUE_TEMPLATE/ @AnthonyLatsis @hborla @LucianoPAlmeida @shahmishal @xedin
21-
/.github/PULL_REQUEST_TEMPLATE.md @AnthonyLatsis @hborla @LucianoPAlmeida @shahmishal @xedin
21+
/.github/ISSUE_TEMPLATE/ @AnthonyLatsis @hborla @shahmishal @xedin
22+
/.github/PULL_REQUEST_TEMPLATE.md @AnthonyLatsis @hborla @shahmishal @xedin
2223

23-
# TODO: /.gitignore
24+
/.gitignore @shahmishal
2425
# TODO: /.mailmap
2526
# TODO: /Brewfile
26-
# TODO: /CHANGELOG.md
27+
/CHANGELOG.md @hborla
2728
# TODO: /CMakeLists.txt
28-
# TODO: /CODE_OF_CONDUCT.md
29-
# TODO: /CODE_OWNERS.TXT
30-
# TODO: /CONTRIBUTING.md
31-
# TODO: /LICENSE.txt
29+
/CODE_OF_CONDUCT.md @swiftlang/core-team
30+
/CODE_OWNERS.TXT @swiftlang/core-team
31+
/CONTRIBUTING.md @AnthonyLatsis @xedin
32+
/LICENSE.txt @swiftlang/core-team
3233
# TODO: /README.md
3334

3435
# Runtimes
@@ -60,7 +61,7 @@
6061
/docs/ABI/RegisterUsage.md @al45tair
6162
/docs/CrossCompilationModel.md @MaxDesiatov
6263
/docs/Generics @slavapestov
63-
/docs/HowToGuides/ @AnthonyLatsis @LucianoPAlmeida @xedin
64+
/docs/HowToGuides/ @AnthonyLatsis @xedin
6465
/docs/Optimizer* @eeckstein
6566
/docs/SIL* @jckarter
6667
/docs/Windows* @compnerd
@@ -223,7 +224,7 @@
223224
/test/Generics/ @hborla @slavapestov
224225
/test/Generics/inverse* @kavon
225226
/test/IDE/ @ahoppen @bnbarham @hamishknight @rintaro
226-
/test/IRGen/ @rjmccall
227+
/test/IRGen/ @AnthonyLatsis @rjmccall
227228
/test/Index/ @ahoppen @bnbarham @hamishknight @rintaro
228229
/test/Interop/ @zoecarver @egorzhdan @Xazax-hun @j-hui @fahadnayyar @susmonteiro @hnrklssn
229230
/test/Macros/SwiftifyImport @hnrklssn @Xazax-hun
@@ -285,17 +286,20 @@
285286

286287
# utils
287288
/utils/*windows* @compnerd
289+
/utils/build_swift/ @etcwilde @justice-adams-apple @shahmishal
288290
/utils/generate-xcode @hamishknight
289291
/utils/gyb_sourcekit_support/ @ahoppen @bnbarham @hamishknight @rintaro
290292
/utils/sourcekit_fuzzer/ @ahoppen @bnbarham @hamishknight @rintaro
291293
/utils/swift-xcodegen/ @hamishknight
294+
/utils/swift_build_support/ @etcwilde @justice-adams-apple @shahmishal
292295
/utils/swift_build_support/products/earlyswiftsyntax.py @ahoppen @bnbarham @hamishknight @rintaro
293296
/utils/swift_build_support/products/skstresstester.py @ahoppen @bnbarham @hamishknight @rintaro
294297
/utils/swift_build_support/products/sourcekitlsp.py @ahoppen @bnbarham @hamishknight @rintaro
295298
/utils/swift_build_support/products/swiftformat.py @ahoppen @allevato @bnbarham @hamishknight @rintaro
296299
/utils/swift_build_support/products/swiftsyntax.py @ahoppen @bnbarham @hamishknight @rintaro
297-
/utils/update-checkout* @shahmishal
298-
/utils/update_checkout/ @shahmishal
300+
/utils/update-checkout* @etcwilde @justice-adams-apple @shahmishal
301+
/utils/update_checkout/ @etcwilde @justice-adams-apple @shahmishal
302+
/utils/update_checkout/update-checkout-config.json @shahmishal
299303
/utils/vim/ @compnerd
300304

301305
# validation-test

CHANGELOG.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,61 @@
55
66
## Swift 6.2
77

8+
* The Swift compiler no longer diagnoses references to declarations that are
9+
potentially unavailable because the platform version might not be new enough
10+
when those references occur inside of contexts that are also unavailable to
11+
that platform. This addresses a long-standing nuisance for multi-platform
12+
code. However, there is also a chance that existing source code may become
13+
ambiguous as a result:
14+
15+
```swift
16+
struct A {}
17+
struct B {}
18+
19+
func potentiallyAmbiguous(_: A) {}
20+
21+
@available(macOS 99, *)
22+
func potentiallyAmbiguous(_: B) {}
23+
24+
@available(macOS, unavailable)
25+
func unavailableOnMacOS() {
26+
potentiallyAmbiguous(.init()) // error: ambiguous use of 'init()'
27+
}
28+
```
29+
30+
Code that is now ambiguous as a result should likely be restructured since
31+
disambiguation based on platform introduction alone has never been a reliable
32+
strategy, given that the code would eventually become ambiguous anyways when
33+
the deployment target is raised.
34+
35+
* [SE-0470][]:
36+
A protocol conformance can be isolated to a specific global actor, meaning that the conformance can only be used by code running on that actor. Isolated conformances are expressed by specifying the global actor on the conformance itself:
37+
38+
```swift
39+
protocol P {
40+
func f()
41+
}
42+
43+
@MainActor
44+
class MyType: @MainActor P {
45+
/*@MainActor*/ func f() {
46+
// must be called on the main actor
47+
}
48+
}
49+
```
50+
51+
Swift will produce diagnostics if the conformance is directly accessed in code that isn't guaranteed to execute in the same global actor. For example:
52+
53+
```swift
54+
func acceptP<T: P>(_ value: T) { }
55+
56+
/*nonisolated*/ func useIsolatedConformance(myType: MyType) {
57+
acceptP(myType) // error: main actor-isolated conformance of 'MyType' to 'P' cannot be used in nonisolated context
58+
}
59+
```
60+
61+
To address such issues, only use an isolated conformance from code that executes on the same global actor.
62+
863
* [SE-0419][]:
964
Introduced the new `Runtime` module, which contains a public API that can
1065
generate backtraces, presently supported on macOS and Linux. Capturing a
@@ -392,7 +447,7 @@ And the module structure to support such applications looks like this:
392447

393448
* [SE-0430][]:
394449

395-
Region Based Isolation is now extended to enable the application of an
450+
Region-Based Isolation is now extended to enable the application of an
396451
explicit `sending` annotation to function parameters and results. A function
397452
parameter or result that is annotated with `sending` is required to be
398453
disconnected at the function boundary and thus possesses the capability of
@@ -430,7 +485,7 @@ And the module structure to support such applications looks like this:
430485

431486
func useValue() {
432487
let x = NonSendableType()
433-
let a = await MyActor(x) // Error without Region Based Isolation!
488+
let a = await MyActor(x) // Error without Region-Based Isolation!
434489
}
435490
```
436491

@@ -10732,6 +10787,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1073210787
[SE-0442]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0442-allow-taskgroup-childtaskresult-type-to-be-inferred.md
1073310788
[SE-0444]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
1073410789
[SE-0458]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0458-strict-memory-safety.md
10790+
[SE-0470]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated-conformances.md
1073510791
[#64927]: <https://github.com/apple/swift/issues/64927>
1073610792
[#42697]: <https://github.com/apple/swift/issues/42697>
1073710793
[#42728]: <https://github.com/apple/swift/issues/42728>

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,13 +1665,14 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD)
16651665

16661666
ExternalProject_Get_Property("${stdlib_target}-core" INSTALL_DIR)
16671667

1668-
ExternalProject_Add("${stdlib_target}-StringProcessing"
1669-
SOURCE_DIR
1670-
"${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental/StringProcessing"
1668+
ExternalProject_Add("${stdlib_target}-Supplemental"
1669+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental"
16711670
DEPENDS "${stdlib_target}-core"
16721671
INSTALL_DIR "${INSTALL_DIR}"
1673-
INSTALL_COMMAND "" # No install story set up yet
1672+
INSTALL_COMMAND ""
1673+
LIST_SEPARATOR "|"
16741674
CMAKE_ARGS
1675+
-DSwift_ENABLE_RUNTIMES=StringProcessing
16751676
-DBUILD_SHARED_LIBS=YES
16761677
-DCMAKE_Swift_COMPILER_WORKS:BOOLEAN=YES
16771678
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
| | **Architecture** | **Build** |
1010
|---|:---:|:---:|
11-
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-macos)|
11+
| **macOS** | Universal |[![Build Status](https://ci.swift.org/job/oss-swift-package-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-macos)|
1212
| **Ubuntu 20.04** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|
1313
| **Ubuntu 20.04** | AArch64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04-aarch64/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04-aarch64)|
1414
| **Ubuntu 22.04** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-22_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-22_04)|
@@ -20,8 +20,6 @@
2020
| **Universal Base Image 9** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-ubi-9/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubi-9)|
2121
| **Debian 12** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-debian-12/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-debian-12)|
2222
| **Debian 12** | AArch64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-debian-12-aarch64/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-debian-12-aarch64)|
23-
| **Fedora 39** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-fedora-39/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-fedora-39)|
24-
| **Fedora 39** | AArch64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-fedora-39-aarch64/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-fedora-39-aarch64)|
2523
| **Windows 10** | x86_64 |[![Build Status](https://ci-external.swift.org/job/swift-main-windows-toolchain/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/swift-main-windows-toolchain)|
2624
| **Windows 10** | ARM64 |[![Build Status](https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64)|
2725

Runtimes/Core/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ include(AvailabilityMacros)
8282
include(CompilerSettings)
8383
include(DefaultSettings)
8484
include(EmitSwiftInterface)
85+
include(InstallSwiftInterface)
8586
include(PlatformInfo)
8687
include(gyb)
8788
include(ResourceEmbedding)
@@ -159,7 +160,7 @@ add_compile_definitions(
159160
$<$<BOOL:${SwiftCore_HAS_DARWIN_LIBMALLOC}>:-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC> # Anything that includes include/swift/Runtime/Config.h
160161
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_THREADING_${SwiftCore_THREADING_PACKAGE}>
161162
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER=$<BOOL:${SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER}>>
162-
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>>)
163+
$<$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS>)
163164

164165
add_compile_options(
165166
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
add_subdirectory(InternalShims)
22

33
gyb_expand(TaskGroup+addTask.swift.gyb TaskGroup+addTask.swift)
4-
gyb_expand(Task+startSynchronously.swift.gyb Task+startSynchronously.swift)
4+
gyb_expand(Task+immediate.swift.gyb Task+immediate.swift)
55

66
add_library(swift_Concurrency
77
Actor.cpp
@@ -12,6 +12,7 @@ add_library(swift_Concurrency
1212
EmbeddedSupport.cpp
1313
Error.cpp
1414
ExecutorBridge.cpp
15+
ExecutorImpl.cpp
1516
ExecutorChecks.cpp
1617
GlobalExecutor.cpp
1718
Setup.cpp
@@ -80,6 +81,8 @@ add_library(swift_Concurrency
8081
PartialAsyncTask.swift
8182
PlatformExecutorDarwin.swift
8283
PlatformExecutorLinux.swift
84+
PlatformExecutorFreeBSD.swift
85+
PlatformExecutorOpenBSD.swift
8386
PlatformExecutorWindows.swift
8487
PriorityQueue.swift
8588
SourceCompatibilityShims.swift
@@ -94,7 +97,7 @@ add_library(swift_Concurrency
9497
TaskSleep.swift
9598
TaskSleepDuration.swift
9699
"${CMAKE_CURRENT_BINARY_DIR}/TaskGroup+addTask.swift"
97-
"${CMAKE_CURRENT_BINARY_DIR}/Task+startSynchronously.swift")
100+
"${CMAKE_CURRENT_BINARY_DIR}/Task+immediate.swift")
98101

99102
include(${SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR}.cmake)
100103
target_compile_definitions(swift_Concurrency PRIVATE
@@ -129,6 +132,10 @@ target_link_libraries(swift_Concurrency PRIVATE
129132
set_target_properties(swift_Concurrency PROPERTIES
130133
Swift_MODULE_NAME _Concurrency
131134
LINKER_LANGUAGE CXX)
135+
if(NOT BUILD_SHARED_LIBS AND CMAKE_STATIC_LIBRARY_PREFIX_Swift)
136+
set_target_properties(swift_Concurrency PROPERTIES
137+
PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX_Swift})
138+
endif()
132139

133140
install(TARGETS swift_Concurrency
134141
EXPORT SwiftCoreTargets

Runtimes/Core/cmake/modules/AvailabilityMacros.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
file(STRINGS "${SwiftCore_SWIFTC_SOURCE_DIR}/utils/availability-macros.def" availability_defs)
1+
configure_file("${SwiftCore_SWIFTC_SOURCE_DIR}/utils/availability-macros.def"
2+
"${CMAKE_CURRENT_BINARY_DIR}/availability-macros.def"
3+
COPYONLY)
4+
file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/availability-macros.def" availability_defs)
25
list(FILTER availability_defs EXCLUDE REGEX "^\\s*(#.*)?$")
36
foreach(def ${availability_defs})
47
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${def}\">")

Runtimes/Core/cmake/modules/EmitSwiftInterface.cmake

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,3 @@ function(emit_swift_interface target)
3131
endif()
3232
endif()
3333
endfunction()
34-
35-
# Install the generated swift interface file for the target if library evolution
36-
# is enabled.
37-
function(install_swift_interface target)
38-
# Install binary swift modules
39-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
40-
RENAME "${SwiftCore_MODULE_TRIPLE}.swiftmodule"
41-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
42-
COMPONENT SwiftCore_development)
43-
if(SwiftCore_VARIANT_MODULE_TRIPLE)
44-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${SwiftCore_VARIANT_MODULE_TRIPLE}/${target}.swiftmodule"
45-
RENAME "${SwiftCore_VARIANT_MODULE_TRIPLE}.swiftmodule"
46-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
47-
COMPONENT SwiftCore_development)
48-
endif()
49-
50-
# Install Swift interfaces if library-evolution is enabled
51-
if(SwiftCore_ENABLE_LIBRARY_EVOLUTION)
52-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftinterface"
53-
RENAME "${SwiftCore_MODULE_TRIPLE}.swiftinterface"
54-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
55-
COMPONENT SwiftCore_development)
56-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.private.swiftinterface"
57-
RENAME "${SwiftCore_MODULE_TRIPLE}.private.swiftinterface"
58-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
59-
COMPONENT SwiftCore_development)
60-
61-
# Install catalyst interface files
62-
if(SwiftCore_VARIANT_MODULE_TRIPLE)
63-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${SwiftCore_VARIANT_MODULE_TRIPLE}/${target}.swiftinterface"
64-
RENAME "${SwiftCore_VARIANT_MODULE_TRIPLE}.swiftinterface"
65-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
66-
COMPONENT SwiftCore_development)
67-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${SwiftCore_VARIANT_MODULE_TRIPLE}/${target}.private.swiftinterface"
68-
RENAME "${SwiftCore_VARIANT_MODULE_TRIPLE}.private.swiftinterface"
69-
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
70-
COMPONENT SwiftCore_development)
71-
endif()
72-
endif()
73-
endfunction()

Runtimes/Core/cmake/modules/ExperimentalFeatures.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ add_compile_options(
44
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SE427NoInferenceOnExtension>"
55
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NonescapableTypes>"
66
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependence>"
7+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependenceMutableAccessors>"
78
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature MemberImportVisibility>"
89
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature TypedThrows>"
910
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Macros>"

0 commit comments

Comments
 (0)