Commit Graph

21502 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
7a6527af83 Merge pull request #82558 from ktoso/wip-cleanup-group-docs 2025-07-11 11:45:15 +09:00
Changhyun Kang
1416a74f11 [Concurrency] fix documentation typos in TaskGroup.swift (#82291) 2025-07-11 11:44:52 +09:00
Konrad 'ktoso' Malawski
fba13f8eda [Concurrency] Add missing Task.immediateDetached, which drops task locals 2025-07-11 08:45:08 +09:00
Konrad 'ktoso' Malawski
6f3099b564 [Concurrency] a few missing overloads for immediate tasks 2025-07-11 08:45:03 +09:00
Philippe Hausler
a349e64039 [Observation] Ensure deinitialized Observable types don't leave active observations in memory (#82752)
Explanation:
This ensures a potential leak with SwiftUI and other systems using
Observation do not leak observation closures when the potential
Observable instances used are only weakly referenced inside the tracking
closure.
 
Scope:
This is limited to the runtime behavior of Observable types and has no
ABI or language level interactions.

Issues:
rdar://112167556

Original PRs:
https://github.com/swiftlang/swift/pull/79823
https://github.com/swiftlang/swift/pull/82307

Risk:
Low - This is very targeted to just Observation, however it is a
behavioral change which does not make this a zero risk change.

Testing:
New unit tests were added to catch at least some of the potential cases
this issue can occur with.
2025-07-10 17:14:27 -04:00
Guillaume Lessard
b78124470c Merge pull request #82896 from glessard/rdar154331399-makeReallyContiguous-62
[stdlib, 6.2] Make String.makeContiguousUTF8() strictly true
2025-07-09 15:47:15 -07:00
Alastair Houghton
bd289dc548 [Concurrency] Remove custom global executors from 6.2.
The custom global executors work is not landing in 6.2, so make
sure it isn't public there.

rdar://151147606
2025-07-09 15:45:15 +01:00
Pavel Yaskevich
3c98a1e76f Merge pull request #82885 from swiftlang/revert-82860-remove-startSynchronously-6.2
Revert "[6.2][Concurrency] Remove deprecated `Task.startSynchronously` API"
2025-07-09 00:19:30 -07:00
Guillaume Lessard
1830334aa3 Merge pull request #82883 from glessard/rdar155275054-default-inits-allspans-62
[stdlib, 6.2] Default initializers for Span-family types
2025-07-08 18:48:07 -07:00
Doug Gregor
958e74c48c Merge pull request #82852 from DougGregor/span-back-deployment-version-fixes-6.2
[6.2] Fix deployment version for Span back-deployment library
2025-07-08 16:09:03 -07:00
Guillaume Lessard
9a6ea014ba [stdlib] update doc-comments and add a code comment 2025-07-08 14:34:49 -07:00
Guillaume Lessard
cd1b2d84f6 [stdlib] make makeContiguousUTF8 stricter 2025-07-08 14:32:27 -07:00
Guillaume Lessard
234dc4145f [gardening] conditional compilation spelling tweak 2025-07-08 14:32:26 -07:00
Pavel Yaskevich
67c787dd1f Revert "[6.2][Concurrency] Remove deprecated Task.startSynchronously API" 2025-07-08 11:35:31 -07:00
Pavel Yaskevich
ea91820604 Merge pull request #82860 from xedin/remove-startSynchronously-6.2
[6.2][Concurrency] Remove deprecated `Task.startSynchronously` API
2025-07-08 11:06:42 -07:00
Guillaume Lessard
3e59e93ee8 [stdlib] add no-parameter initializers for Span types
This was an addition in SE-0485.
2025-07-08 09:47:52 -07:00
Guillaume Lessard
f82f761d0a Merge pull request #82844 from glessard/rdar155198823-mutableSpan-unwrap
[stdlib, 6.2] fix some unsafe errors
2025-07-07 18:07:43 -07:00
Doug Gregor
eac4b9daed Fix minimum deployment versions for Span back-deployment dylib 2025-07-07 17:08:07 -07:00
Pavel Yaskevich
aa89147743 [Concurrency] Remove deprecated Task.startSynchronously API
This is the original spelling which was not accepted. We kept
it for a bit to give adopters time to switch but it's time to
remove it now.

(cherry picked from commit e108524d98)
2025-07-07 16:47:56 -07:00
Guillaume Lessard
86bf7148fa [stdlib, 6.2] add span properties for backdeployment (#82748)
- Explanation:
Makes as many of the `span`, `bytes`, `mutableSpan` and `mutableRawSpan`
properties as possible available to backdeployed targets. This is
possible when the implementation only relies on pre-existing code.

- Resolves: rdar://153654652 (https://forums.swift.org/t/80513)
- Risk: low
- Main branch PR: https://github.com/swiftlang/swift/pull/82598
- Reviewed by: @atrick 
- Testing: existing tests
2025-07-07 14:04:36 -04:00
David Smith
5b726bc5b3 [6.2] Improve memoization of conformance lookups during casting (#82746) 2025-07-07 10:53:57 -07:00
Guillaume Lessard
74acd4104f [stdlib] fix some unsafe errors 2025-07-07 10:30:37 -07:00
Alastair Houghton
8eb879831c Merge pull request #81940 from al45tair/eng/PR-152498657
Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
2025-07-07 12:04:38 +01:00
Alastair Houghton
0813e95569 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-07-07 12:04:00 +01:00
Doug Gregor
c2696775b5 [Runtime] Don't fail conformances when the global actor hook is missing
When the concurrency library's "is current global actor" hook is not
available, assume that we are already executing on the right global
actor. This mimics the behavior of earlier standard libraries when
faced with an isolated conformance, as well as dealing with odd
configurations where the code might not load the concurrency library
yet

At the moment, WebAssembly ends up in this configuration because we
don't run the initialization for the concurrency library. That makes
this also a workaround for issue #82682 / rdar://154762027.
2025-07-05 08:51:59 -07:00
Henrik G. Olsson
43d8b13cf1 Merge pull request #82644 from hnrklssn/cherry-pick-macro-adjustment-check
Cherry-pick "Merge pull request #81855 from hnrklssn/swiftify-availability-check-sdk"
2025-07-03 11:07:43 -07:00
Alastair Houghton
ca00dc4ce4 Merge pull request #82634 from al45tair/eng/PR-154282813-6.2
[Backtracing][Linux] Fix crash handler for musl.
2025-07-03 15:08:06 +01:00
Alastair Houghton
2323449a00 Merge pull request #82526 from al45tair/eng/PR-153531418-6.2
[Concurrency] Rename Dummy(Main|Task)Executor.
2025-07-03 15:07:34 +01:00
Allan Shortlidge
1a7e16ac97 Merge pull request #82759 from tshortli/async-priority-tests-6.2
[6.2] SILGen: Fix mis-compile of `#if available` with `-disable-availability-checking`
2025-07-03 06:39:11 -07:00
David Smith
f8c1df8e09 [6.2] Native implementation of -lengthOfBytesUsingEncoding (#82747) 2025-07-03 05:08:37 -07:00
Alex Martini
6b838fb12e Merge pull request #82636 from amartini51/typo_154473231_CHERRYPICK
Fix repeated words in documentation

Fixes: rdar://154473231
2025-07-02 23:02:52 -07:00
Konrad 'ktoso' Malawski
cb7bc98931 [StdlibUnittest] Warn if no tests were executed 2025-07-02 22:14:56 -07:00
Guillaume Lessard
a348c51ecc Merge pull request #82703 from glessard/rdar154776967-generalize-expectNil-62 2025-07-02 20:39:43 -07:00
Alastair Houghton
c56ec77fdb Merge pull request #82564 from al45tair/eng/PR-154346018-6.2
[Concurrency] Prevent negative sleeps from sleeping forever.
2025-07-02 14:31:51 +01:00
Doug Gregor
7d10f95f6a Merge pull request #82662 from DougGregor/back-deploy-main-actor-isolated-deinit-6.2
[6.2] [SE-0371] Back-deploy support for main-actor-isolated deinit
2025-07-02 00:13:47 -07:00
Guillaume Lessard
1e6a65a840 [stdlibUnittest] adjust spellings and a flag 2025-07-01 16:59:25 -07:00
Doug Gregor
a74e7e014a Don't implement swift_task_deinitOnExecutorMainActorBackDeploy in the task-to-thread model 2025-07-01 16:06:25 -07:00
Guillaume Lessard
0a13d1e8ba [stdlibUnittest] generalize expectNil(_:) 2025-07-01 15:30:45 -07:00
Guillaume Lessard
fbe73da41d Merge pull request #82597 from glessard/rdar145487409-inlinearray-plus-mutablespan-62
[6.2, stdlib] Remove _withUnsafeBufferPointer APIs on InlineArray
2025-07-01 14:10:04 -07:00
Stephen Canon
8da8df8a26 Replace some precondition with _precondition in the stdlib. (#82641) (#82656)
**Explanation:** Replace some `precondition` usage that slipped into the
stdlib with `_precondition`
**Resolves:** rdar://152529291
**Main Branch PR:** #82641
**Risk:** Very Low.
**Reviewed By:** @Azoy 

Cherry-pick from https://github.com/swiftlang/swift/pull/82641
2025-07-01 16:32:32 -04:00
Doug Gregor
42e1610607 Switch to the appropriate C calling convention for pthread_main_np 2025-07-01 08:15:04 -07:00
Konrad `ktoso` Malawski
8f9c14f4cb Merge pull request #82621 from ktoso/pick-deprecate-extractisolation 2025-07-01 15:20:09 +09:00
Konrad `ktoso` Malawski
0eb6263b6d [6.2][Concurrency] Remove experimental @Task macro (#82622) 2025-06-30 23:02:12 -07:00
Doug Gregor
dc27da053c [SE-0371] Back-deploy support for main-actor-isolated deinit
When targeting a platform that predates the introduction of isolated
deinit, make a narrow exception that allows main-actor-isolated deinit
to work through a special, inlineable entrypoint that is
back-deployed. This implementation

  1. Calls into the real implementation when available, otherwise
  2. Checks if we're on the main thread, destroying immediately when
we are, otherwise
  3. Creates a new task on the main actor to handle destruction.

This implementation is less efficient than the implementation in the
runtime, but allows us to back-deploy this functionality as far back
as concurrency goes.

Fixes rdar://151029118.
2025-06-30 17:40:00 -07:00
Henrik G. Olsson
9de099a4b0 Merge pull request #81855 from hnrklssn/swiftify-availability-check-sdk
[Swiftify] Adjust _SwiftifyImport invocation to align with the signature

(cherry picked from commit e9ba8f8a03)
2025-06-30 12:02:55 -07:00
Alex Martini
bdfc10d366 Fix repeated text
(cherry picked from commit 3928ddfeb4)
2025-06-30 09:47:43 -07:00
Alastair Houghton
9cb9ebda31 [Backtracing][Linux] Fix crash handler for musl.
Musl's `clone()` wrapper returns `EINVAL` if you try to use `CLONE_THREAD`,
which seems a bit wrong (certainly it is in this particular application,
since we *really* don't care whether the thread is a valid C library
thread at this point).

Also properly support ELF images that are built with a base address other
than zero (this typically isn't an issue for dynamically linked programs,
as they will be relocated at runtime anyway, but for statically linked
binaries it's very common to set the base address to a non-zero value).

rdar://154282813
2025-06-30 17:42:11 +01:00
Adrian Prantl
637a043453 Merge pull request #82345 from adrian-prantl/expected-lowering-6.2
[Reflection] Add lightweight error handling to ReflectionContext
2025-06-30 09:23:13 -07:00
Konrad 'ktoso' Malawski
b7ec436184 [Concurrency] Deprecate extractIsolation 2025-06-30 20:33:27 +09:00
Guillaume Lessard
ff7596c9a4 [stdlib] improve more accessor declarations 2025-06-28 03:52:20 -07:00