Commit Graph

226 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski efd8843a26 [Distributed][docs] Fix cut off sentence (#89279)
Fix cut off sentence in executor explanation.

resolves rdar://177443891
2026-05-20 06:37:00 -07:00
Doug Gregor 453277eb74 Mark the various with* functions as @safe
Functions like withUnsafeBufferPointer are, by themselves, safe to
call. It's only the operations on the unsafe pointers passed into the
closure that are the safety issue.

This was the intent spelled out in SE-0458 but was not fully realized
in the library.

Fixes rdar://174519372.
2026-04-16 22:37:54 -07:00
Allan Shortlidge ec6bb44c74 stdlib: Adopt #if os(anyAppleOS).
Replace error prone and verbose compilation conditionals like

```
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
```

with

```
#if os(anyAppleOS)
```
2026-03-26 10:19:00 -07:00
Alex Martini 94de6427b6 Merge pull request #84477 from amartini51/docs_cleanup
Fixes: rdar://115730302
Fixes: rdar://158722889
2025-10-03 11:56:09 -07:00
Erik Eckstein 2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
Alex Martini 3ad3421e01 Break up long sentence; fix punctuation
Fixes: rdar://115730302
2025-09-23 16:27:51 -07:00
Eric Miotto eab65319f9 Distributed: do not import all of Darwin to implement locking facilities
At the same time, drop that dependency in the new build system, so that
we don't add an additional linkage for Darwin platforms compared to what
we are doing in the current build system.

Addresses rdar://158314427
2025-08-14 08:51:36 -07:00
Gabor Horvath 402ad33463 [StrictMemorySafety] Check the safety of return types of calls
Previously, we skipped checking the return type of a function for safety
as we expected to warn at the use of the returned value:

  let x = returnsUnsafe()
  usesUnsafe(x) // warn here

Unfortunately, this resulted in missing some unsafe constructs that can
introduce memory safety issues when the use of the return value had a
different shape resulting in false negatives for cases like:

  return returnsUnsafe()

or

  usesUnsafe(returnsUnsafe())

This PR changes the analysis to always take return types of function
calls into account.

rdar://157237301
2025-08-05 12:16:44 +01:00
Allan Shortlidge 008efc432f stdlib: Fix missing unsafe operators in more places.
Add `unsafe` where it is still missing. I missed these in previous passes due
to conditional compilation.
2025-06-22 18:46:57 -07:00
Saleem Abdulrasool c17e67e1a9 stdlib: handle unsafe annotations in additional places
This applies more annotations in the `INTERNAL_CHECKS_ENABLED` disabled
paths, Windows, 32-bit, and non-ObjC paths. Interestingly enough, there
are a couple of compiler intrinsics which are also uncovered.
2025-06-18 09:46:17 -07:00
Ian Anderson 15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07:00
Eric Miotto 8c7e8550aa CMake: add explicit dependency to _Builtin_float to targets...
... that would import that as a result of importing Darwin from the SDK.

Amend my previous change to Differentiation and Distributed in this
sense.

Addresses rdar://150400049
2025-05-05 10:39:14 -07:00
Eric Miotto ea74546e15 Merge pull request #81141 from edymtt/edymtt/add-builtin-float-dep-to-distributed-and-synchronization
Add `_Builtin_float` dependency to `Distributed` and `Synchronization`
2025-04-29 12:32:23 -07:00
Eric Miotto 231a9d989d Add _Builtin_float dependency to Distributed and Synchronization
This will avoid errors in CI when the latter ones are scheduled before
the former.

Addresses rdar://149558141
2025-04-28 09:37:07 -07:00
Doug Gregor 050a514588 [Strict memory safety] Update standard library for unsafe treated as a call effect 2025-04-25 21:54:23 -07:00
Mike Ash 433ca8ea81 Merge pull request #80516 from mikeash/function-cast
[Runtime] Add function_cast, switch from std::bit_cast.
2025-04-11 05:15:25 -04:00
Mike Ash 185b739cf1 [Runtime] Add function_cast, switch from std::bit_cast.
Function types aren't always trivially copyable, e.g. with address-discriminated signed pointers on ARM64e. Introduce a function_cast helper and use that instead.
2025-04-10 20:29:02 -04:00
Doug Gregor 0100104ff7 [stdlib] Reinstate AllowUnsafeAttribute experimental feature on libraries
We need this so that older compilers can handle the .swiftinterface
files we generate. It's unnecessary for newer compilers and can be
removed later.

Fixes rdar://148529962.
2025-04-03 18:07:19 -07:00
Allan Shortlidge dbd3d40c07 stdlib: Address StrictMemorySafety warnings in KeyPath related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge 0c69e2db07 Distributed: Add visionOS to Apple platform conditionals. 2025-03-28 12:33:40 -07:00
Allan Shortlidge 322daab362 Distributed: Add unsafe keyword to uses of pthreads. 2025-03-28 12:33:40 -07:00
Doug Gregor d9b5a4621f Enable strict memory safety in the Distributed module 2025-02-26 14:28:26 -08:00
Saleem Abdulrasool 35cbb211c1 Distributed: silence some -Wcast-function-type-mismatch
This silences some of the newer warnings about the casting of function
pointers which is technically not permitted by the standard (function
and data pointers are not guaranteed to be the same).
2025-01-29 17:46:37 -08:00
Meghana Gupta 02a58738a0 Remove -enable-ossa-module for Synchronization and Distributed
These modules import Darwin which is not in ossa. -enable-ossa-modules
results in a one-time recompilation of dependencies when they are not in ossa.
This is not compatible with Explicit Build Modules when the original invocation
did not have -enable-ossa-modules.
2024-10-31 10:55:35 -07:00
Konrad `ktoso` Malawski d41c9c2e8b [Distributed] improve control flow of result buffer init detection 2024-10-07 23:26:47 +09:00
Konrad `ktoso` Malawski e8c25a456d [Distributed] fix deinitialization of result buffer 2024-10-05 14:40:11 +09:00
Konrad `ktoso` Malawski 41d8962783 Revert "Revert "Revert "[Distributed] remote calls over-retain returned values""" 2024-10-04 06:53:43 +09:00
Konrad `ktoso` Malawski f45f683f24 Merge pull request #76627 from swiftlang/revert-76623-revert-76595-wip-release-dist-execute-return 2024-10-03 19:15:59 +09:00
Konrad `ktoso` Malawski 62b04be2fa Revert "Revert "[Distributed] remote calls over-retain returned values"" 2024-09-21 14:50:35 +09:00
Konrad `ktoso` Malawski 9779137dc9 Revert "[Distributed] remote calls over-retain returned values" 2024-09-21 13:58:43 +09:00
Konrad `ktoso` Malawski 3f371fd0a6 Merge pull request #76595 from ktoso/wip-release-dist-execute-return
[Distributed] remote calls over-retain returned values
2024-09-21 08:21:38 +09:00
Konrad `ktoso` Malawski d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
Konrad `ktoso` Malawski a12420a739 [Distributed] Must deinitialize return value of remoteCall
resolves rdar://136338200
resolves rdar://136313477
2024-09-20 14:33:46 +09:00
Alastair Houghton 0963036734 [Build] Make sure we declare LINUX_STATIC dependencies on Musl.
Everywhere there's a `SWIFT_MODULE_DEPENDS_LINUX Glibc`, there should be
a corresponding `SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl`.

This usually won't bite us, depending on build order and parallelism, but
I hit one of these yesterday so went looking to see if there were any
others.

rdar://136208589
2024-09-18 09:40:58 +01:00
Konrad `ktoso` Malawski 7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Alex Hoppen c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Mykola Pokhylets 6151731d26 Updated implementation to handle SWIFT_CONCURRENCY_ACTORS_AS_LOCKS 2024-08-13 12:30:21 +02:00
Allan Shortlidge 20d97556ae stdlib: Remove #if $TypedThrows guards.
https://github.com/swiftlang/swift/pull/72612 can be reverted because it is no
longer necessary for the interface of the stdlib to be compatible with
compilers without `$TypedThrows` support.
2024-07-08 16:52:52 -07:00
Alexander Cyon c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Konrad `ktoso` Malawski 8ea87e40af [Distributed] Adjust whenLocal impl to avoid potential ABI issues 2024-06-21 11:36:18 +09:00
Konrad `ktoso` Malawski 8a88569c6b [Distributed] remoteCallVoid is a new requirement in Swift 6.0
And it is handled compatibly because all existing implementations must
have already implemented it before -- it was an ad-hoc requirement
before Swift 6.0, and now it has become a real requirement - the same as
all the other ad-hoc requirements relying on the Serialization
Requirement
2024-06-12 16:32:30 +09:00
Konrad `ktoso` Malawski 3b95855a28 [Distributed] Reword docs since we no longer have ad-hoc requirements 2024-06-12 16:32:30 +09:00
Konrad `ktoso` Malawski b5dc34984d [Distributed] Typed throws for whenLocal: func must be @_AEIC 2024-06-12 16:32:27 +09:00
Alex Lorenz 5aa63fc93e Merge pull request #72634 from hyp/eng/android/ndk-overlay
[android] add an Android NDK Swift overlay
2024-06-05 19:35:13 -07:00
Holly Borla c20b0e0956 [Concurrency] Obsolete AnyActor in Swift 6 using a typealias. 2024-05-29 22:59:19 -07:00
Alex Lorenz 57b89d5303 [android] add an android NDK Swift overlay module, and use it instead of Glibc 2024-05-28 12:57:38 -07:00
Pavel Yaskevich e6b445b8d1 [SE-0428] NFC: Rename _DistributedProtocol macro into Resolvable
The proposal was [accepted with modifications](https://forums.swift.org/t/accepted-with-modifications-se-0428-resolve-distributedactor-protocols/71366)

The decision was made to change the spelling of the attached macro
in the proposal from @DistributedProtocol to `@Resolvable`
(or `@Distributed.Resolvable` if disambiguation is needed).
2024-04-22 14:18:11 -07:00
Michael Gottesman cf93476d0b [region-isolation] Require T in assumeIsolated<T> to be Sendable.
I had to change the APIs to always be always emit into client instead of back
deployable since silgen_name seems to interfere with @backDeployment. So I
switched the implementation so that it instead uses an always emit into client
thunk with the in source function name and a usableFromInline function that has
the silgen_name. This ensures that we still appropriately export the same symbol
as we did before, so it is ABI stable.

This was approved as part of se-0414.

rdar://122030520
2024-04-02 13:49:13 -07:00
Konrad `ktoso` Malawski 86f5441294 [SerialExecutor] SerialExecutor.checkIsolated() to check its own tracking for isolation checks (#71172) 2024-03-29 07:06:34 +09:00
Holly Borla 5d9ad87a82 [Concurrency] Task executors are available in Swift 6.0. 2024-03-13 09:56:24 -07:00