Commit Graph

21665 Commits

Author SHA1 Message Date
Meghana Gupta
b3b2f37262 Merge pull request #72822 from stephentyrone/a-a-ambiguity-breaker-part-ii
Further ambiguity breakers for UDC & SEDC
2024-04-04 15:10:59 -07:00
Kuba Mracek
a79e4347ab [embedded] Default Embedded Concurrency to single-threaded 2024-04-04 15:07:47 -07:00
Kuba (Brecka) Mracek
a263bca690 Merge pull request #72772 from kubamracek/embedded-concurrency-deps
[embedded] Add a test checking the dependencies of Embedded Concurrency runtime
2024-04-04 11:04:04 -07:00
Alastair Houghton
419214daf9 [Runtime] Disable prespecialized metadata if we have overridden images.
We need to check for overridden images on every image load, otherwise
XCTest (among others) may `dlopen()` an image that pulls in something
that is overridden, at which point the prespecialized metadata won't
match the image we loaded.

rdar://125727356
2024-04-04 16:20:12 +01:00
Alejandro Alonso
36569ea6b6 Merge pull request #72821 from Azoy/keypath-null-bad
[stdlib] Print a special message when we fail getting a keypath value
2024-04-03 19:56:02 -07:00
Kavon Farvardin
e759a28f56 Merge pull request #72786 from kavon/ncgenerics-associatedtype-restriction
NCGenerics: introduce `SuppressedAssociatedTypes`
2024-04-03 16:28:54 -07:00
Stephen Canon
cb400c61bb Add further ambiguity breakers for UDC & SEDC 2024-04-03 18:47:19 -04:00
Alejandro Alonso
e71a55eb19 Print a special message when we fail getting a keypath value 2024-04-03 15:35:55 -07:00
Stephen Canon
cbf9cb2734 Break ambiguity for types conforming to both UEC and SVEC (#72800)
* Break ambiguity for types conforming to both UEC and SVEC

If an encoding container conforms to _both_ UEC and SVEC and does not
itself implement support for [U]Int128, there is an ambiguity between
the two default implementations. Add additional defaults defined on
the intersection of the protocols to resolve this.

* Update abi tests for new ambiguity breakers.
2024-04-03 16:53:48 -04:00
Doug Gregor
e5d7885fc8 Merge pull request #72788 from DougGregor/metadata-runtime-inverse-conformances-assoctype
Runtime checking for associated types conforming to invertible protocols
2024-04-03 08:30:50 -07:00
Michael Gottesman
302b0101e6 Merge pull request #72763 from gottesmm/pr-d6b1f7e0bfc91f3d28ecf7bd100f45f41533688a
[region-isolation] Require T in assumeIsolated<T> to be Sendable.
2024-04-02 23:46:59 -07:00
Ben Barham
293a4341c9 Merge pull request #72744 from bnbarham/rename-endswith
Rename `StringRef::endswith` references to `StringRef::ends_with`
2024-04-02 20:08:01 -07:00
Kavon Farvardin
30983530b6 NCGenerics: introduce SuppressedAssociatedTypes
The model for associated types hasn't been fully worked-out for
noncopyable generics, but there is some support already that is being
used by the stdlib for an internal-only (and rather cursed) protocol
`_Pointer` to support `UnsafePointer`, etc.

This patch gates the existing experimental support for associated types
behind a feature flag. This flag doesn't emit feature-guards in
interfaces, since support for it is tied closely to NoncopyableGenerics
and has been there from its early days.
2024-04-02 16:53:36 -07:00
Doug Gregor
ae01d20428 Runtime checking for associated types conforming to invertible protocols
Emit metadata for runtime checks of conformances of associated types to
invertible protocols, e.g., `T.Assoc: Copyable`. This allows us to
correctly handle, e.g., dynamic casting involving conditional
conformances that have such constraints.

The model we use here is to emit an invertible-protocol constraint
that leaves only the specific bit clear in the invertible protocol
set.
2024-04-02 16:42:16 -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
Stephen Canon
a381589524 SE-0425 implementation (#72139) 2024-04-02 16:24:41 -04:00
Kuba Mracek
280123cb10 [embedded] Add a test checking the dependencies of Embedded Concurrency runtime 2024-04-02 10:33:33 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Yuta Saito
132ba8950b [Concurrency] Fix signature mismatch of _task_serialExecutor_checkIsolated
`_task_serialExecutor_checkIsolated` is defined as returning nothing in
`Executor.swift`, but it was used as returning a boolean in C++ side.
2024-03-31 04:48:50 +00:00
Kuba Mracek
a35db85e82 [embedded] Build the macOS Embedded Stdlib with a recent deployment target 2024-03-29 16:10:35 -07:00
Doug Gregor
989d4ba40e Merge pull request #72698 from DougGregor/suppress-suppressible
Rename "suppressible protocols" to "invertible protocols".
2024-03-29 14:35:05 -07:00
Nate Cook
38e1370884 Revert "Revert count(where:)" (#70816)
* Revert "Revert count(where:)"

This reverts commit 779ea19a6a.

Now that SE-0220 has been re-accepted, this adds the `count(where:)` 
Sequence method to the standard library.
2024-03-29 13:53:53 -05:00
Doug Gregor
b84f8ab080 Rename "suppressible protocols" to "invertible protocols".
We've decided to use the "invertible protocols" terminology throughout
the runtime and compiler, so move over to that terminology
consistently.
2024-03-29 11:31:48 -07:00
Doug Gregor
fb584f8934 Merge branch 'main' into async-sequence-fixes 2024-03-28 16:01:54 -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
Joe Groff
233c1675cf Merge pull request #72647 from jckarter/borrowing-switch-expr-based-ownership
Alternative noncopyable switch design based on expression kind.
2024-03-28 14:44:16 -07:00
Alejandro Alonso
af11b95f4d Merge pull request #72656 from weissi/jw-fix-json
fix GroupInfo.json: was invalid JSON
2024-03-28 13:31:23 -07:00
Doug Gregor
a8f3bb5e5e Implement AsyncIteratorProtocol.next() in terms of next(isolation:).
New async iterators should be able to implement only `next(isolation:)` and
get the older `next()` implementation via a default. Implement the
appropriate default witness.

Fixes rdar://125447861.
2024-03-28 12:59:12 -07:00
Alejandro Alonso
07eb52a80d Merge pull request #72636 from Azoy/destroy-array-opt
[IRGen] Optimize Builtin.arrayDestroy when count is 1
2024-03-28 11:32:43 -07:00
Eric Miotto
93d64e973d Merge pull request #72590 from edymtt/edymtt/no-darwin-binary-swiftmodule-in-toolchain
Do not install binary swiftmodule for Darwin
2024-03-28 09:22:32 -07:00
Joe Groff
ba3494802a Alternative noncopyable switch design based on expression kind.
If an expression refers to noncopyable storage, then default to performing
a borrowing switch, where `let` bindings in patterns borrow out of the
matched value. If an expression refers to a temporary value or explicitly
uses the `consume` keyword, then perform a consuming switch, where
`let` bindings take ownership of corresponding parts of the matched value.
Allow `_borrowing` to still be used to explicitly bind a pattern variable
as a borrow, with no-implicit-copy semantics for copyable values.
2024-03-28 08:32:48 -07:00
Allan Shortlidge
05a5bc4023 Merge pull request #72608 from tshortli/non-copyable-generics-2
AST/Frontend/stdlib: Fix condfails for NoncopyableGenerics and IsolatedAny
2024-03-28 08:23:24 -07:00
Johannes Weiss
3f5c3244ce fix GroupInfo.json: was invalid JSON 2024-03-28 13:07:18 +00:00
Allan Shortlidge
590d3353e6 Frontend: Introduce an alias for the IsolatedAny experimental feature.
To preserve compatibility with older compilers that do not allow `IsolatedAny`
to be enabled in production compilers, use an alias experimental feature when
building the stdlib (`IsolatedAny2`).

Also, add `@_allowFeatureSuppression(IsolatedAny)` in a couple spots it was
forgotten.

Partially resolves rdar://125138945
2024-03-27 22:20:50 -07:00
Allan Shortlidge
37034282a1 stdlib: Adopt @_disallowFeatureSuppression(NoncopyableGenerics).
This prevents some re-declaration errors when building the standard library
from its `.swiftinterface` with older compilers.
2024-03-27 22:20:50 -07:00
Allan Shortlidge
2813fbe309 Frontend: Introduce an alias for the NoncopyableGenerics experimental feature.
The `.swiftinterface` of the standard library must remain compatible with some
older compilers. Unfortunately, some of those older compilers do not allow the
experimental feature `NoncopyableGenerics` to be enabled in production. To
allow the stdlib to build with non-copyable generics enabled and still have the
older compilers consume its interface, we have to use a new experimental
feature identifier that they do not know about.

Partially resolves rdar://125138945
2024-03-27 22:20:25 -07:00
Allan Shortlidge
ceee7648ae Merge pull request #72645 from tshortli/async-sequence-condfails
Concurrency: Declare explicit Failure typealiases on AsyncSequence iterators
2024-03-27 22:02:54 -07:00
Allan Shortlidge
9e875f9839 Concurrency: Declare explicit Failure typealiases on AsyncSequence iterators.
Associated type inference ought to take care of providing the `Failure`
typealias for these `AsyncIteratorProtocol` types. However, the inferred
typealias is printed with `@_implements` in the `.swiftinterface`, guarded with
the `$AssociatedTypeImplements` language feature guard, which means older
compilers cannot see the typealias and therefore think the conformance is
incomplete. To make sure the `_Concurrency` module's interface is backward
compatible, we must manually define these typealiases temporarily.

Part of rdar://125138945
2024-03-27 18:09:53 -07:00
Allan Shortlidge
a1dacc12d7 stdlib: Make typed throws ABI placeholders properly @usableFromInline.
Functions that are used in public `@inlinable` function bodies can't be marked
`@_spi` nor can they be made obsolete. Also, they must retain `rethrows` so
that use of these entry points from other `rethrows` functions is accepted.

Builds on https://github.com/apple/swift/pull/72365. Once we no longer have to
support pre-`$TypedThrows` compilers, all of this can be reverted.

Part of rdar://125138945
2024-03-27 14:57:56 -07:00
Alejandro Alonso
8ea3426273 Update comment about arrayDestroy in pointer 2024-03-27 14:02:06 -07:00
Doug Gregor
bbfdf7b36a Merge pull request #72470 from DougGregor/dynamic-suppressible-protocols
Metadata and runtime support for suppressible protocol requirements
2024-03-27 11:49:00 -07:00
Eric Miotto
0cac358fe5 Do not install binary swiftmodule for Darwin
This is needed to support Apple internal configurations that would fail
consuming such binary swiftmodule (but work as expected when rebuilding
from the swiftinterface).

Addresses rdar://124390643
2024-03-27 10:56:55 -07:00
Kuba (Brecka) Mracek
70d1d998ab Merge pull request #72530 from kubamracek/embedded-add-ivar-destroyers
[embedded] Add IVarDestroyers into class metadata, add support for throws in initializers
2024-03-27 09:12:34 -07:00
Yuta Saito
52e8fbc115 Merge pull request #72345 from kateinoigakukun/katei/has-feature-swiftcall
[embedded] Use `__has_feature(swiftcc)` to detect Swift calling convention
2024-03-27 19:39:25 +09:00
Doug Gregor
cd20dbafbf [Runtime] Don't check suppressible protocols for non-key generic arguments 2024-03-26 21:33:53 -07:00
Kuba Mracek
37d9be636a [embedded] Handle NULL IVarDestroyers, expand test 2024-03-26 21:14:21 -07:00
Kuba Mracek
b8bd832fba [embedded] Add IVarDestroyers into class metadata, add support for throws in initializers 2024-03-26 20:52:17 -07:00
Eric Miotto
649618dc36 Remove duplicate call to install() for stdlib modules
Also amend the installation code handling macCatalyst to match the one
for regular swiftmodules.
2024-03-26 09:48:36 -07:00
Kuba (Brecka) Mracek
c256c1f594 Merge pull request #72563 from kubamracek/embedded-isUniquelyReferenced_native
[embedded] Add swift_isUniquelyReferenced_native into the embedded runtime
2024-03-26 09:16:12 -07:00
Kuba Mracek
8f247e2d36 [embedded] Add swift_isUniquelyReferenced_native into the embedded runtime 2024-03-25 11:51:01 -07:00