Commit Graph

21803 Commits

Author SHA1 Message Date
Dmitrii Galimzianov
4509b22415 Revert "Protocol conformance cache for generic types"
This reverts commit 7989dbe24e merged in https://github.com/swiftlang/swift/pull/82818
2025-08-16 01:39:16 +02:00
Egor Zhdan
0f963d7819 Merge pull request #83727 from egorzhdan/egorzhdan/std-string-ctor
[cxx-interop] Simplify `std::string` construction in the overlay
2025-08-15 10:47:01 +01:00
Konrad `ktoso` Malawski
5857afebd8 Merge pull request #83726 from edymtt/edymtt/use-darwin-os-lock-in-distributed 2025-08-15 09:23:39 +09:00
Eric Miotto
2c5fdec56a Merge pull request #83725 from edymtt/edymtt/use-darwin-os-lock-in-observation
Observation: do not import all of Darwin to implement locking facilities
2025-08-14 17:00:31 -07:00
Guillaume Lessard
709156b215 Merge pull request #83686 from glessard/legacy-abi-rethrows
[stdlib] apply the legacy ABI pattern to 3 functions
2025-08-14 15:53:17 -07:00
Eric Miotto
1a8cca247d CMake: allow more private libraries to be used on older OSes
I missed a few when tackling #83602

Take the chance to ensure swiftStdlibUnittestFoundationExtras builds
zippered.

Addresses rdar://158264124
2025-08-14 10:52:15 -07:00
Egor Zhdan
7dc8873266 [cxx-interop] Simplify std::string construction in the overlay
libc++ provides a 2-parameter constructor of `std::string`, so we can apply the logic under `#if os(Windows)` on Apple platforms too.

This avoids deserialization issues when building some complex projects that are still under investigation.

rdar://145939013
2025-08-14 17:45:19 +01: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
Eric Miotto
4da993f368 Observation: 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://158313871
2025-08-14 08:35:06 -07:00
Saleem Abdulrasool
4a54598bbb Merge pull request #83699 from compnerd/include
build: adjust the system include directory flag for Windows
2025-08-14 08:12:56 -07:00
Gábor Horváth
8558931bd0 Merge pull request #83638 from Xazax-hun/swift-span-for-cxx-string 2025-08-14 07:42:57 +01:00
Anthony Latsis
8b27282324 Merge pull request #83675 from swiftlang/jepa-rebranch2
runtime: Silence a `-Wglobal-constructors` error than appears with upstream clang on Windows
2025-08-14 00:04:21 +01:00
Saleem Abdulrasool
162df1d5f4 Merge pull request #83643 from compnerd/mirror-warnings
SwiftRemoteMirror: adjust for Windows
2025-08-13 13:34:12 -07:00
Saleem Abdulrasool
cf2993ca94 build: adjust the system include directory flag for Windows
This adjusts the flag to be `clang-cl` compatible rather than `clang`
compatible on Windows. `-Isystem` would cause the include search path to
be ignored, whereas `-imsvc` allows us to honour the path. This is
important when using the external dispatch.
2025-08-13 13:00:16 -07:00
Gabor Horvath
2bd8684868 [cxx-interop] Add span accessors to std.string variants
rdar://146944876
2025-08-13 15:49:39 +01:00
Anthony Latsis
311ff73a7f runtime: Silence a -Wglobal-constructors error than appears with upstream clang on Windows
Landing this on main to minimize rebranch-specific changes.
2025-08-13 00:32:23 +01:00
Guillaume Lessard
d1f7140357 [stdlib] apply the legacy ABI pattern to 3 functions 2025-08-12 16:15:13 -07:00
Erik Eckstein
e28125b106 stdlib: specialize OptionSet.insert for FixedWidthInteger raw-values
This lets the generated code boil down to a single or-instruction.

rdar://157958188
2025-08-12 08:05:49 +02:00
Hiroshi Kimura
db7717f411 Update Observations.swift 2025-08-12 06:15:56 +09:00
Karoy Lorentey
14b9b80746 Merge pull request #83314 from lorentey/pushing-word-boundaries
[stdlib] Fix implementation of Unicode text segmentation for word boundaries
2025-08-11 11:28:39 -07:00
Saleem Abdulrasool
d5412665e0 SwiftRemoteMirror: adjust for Windows
This cleans up the warnings when building on Windows. It is cleaning up
the warnings related to deprecated POSIX APIs.
2025-08-11 09:50:23 -07:00
Eric Miotto
9d7d3a15cb Merge pull request #83602 from edymtt/edymtt/ensure-private-libraries-can-run-on-older-oses
CMake: allow private libraries to be used on older OSes
2025-08-11 06:37:48 -07:00
Alex Martini
4b292b30f2 Merge pull request #83049 from amartini51/object_id_149961845
Update docs for ObjectIdentifier to mention actors

Fixes: rdar://149961845
2025-08-08 11:54:29 -07:00
Gábor Horváth
35b5c817b2 Merge pull request #83520 from Xazax-hun/check-safety-function-types 2025-08-08 06:39:39 +01:00
Eric Miotto
332fe6a475 CMake: allow private libraries to be used on older OSes
To do so, use the deployment target versions used for tests.

Addresses rdar://157622116
2025-08-07 15:12:47 -07:00
Eric Miotto
4a95275bde CMake: do not link StringProcessing into StdlibUnittest
Since #64187 we are not importing automatically StringProcessing when
building the stdlib -- this is especially important for StdlibUnittest,
since it needs to run on older OSes.

Addresses rdar://157622116
2025-08-07 15:06:52 -07:00
Saleem Abdulrasool
21d8afdc41 Merge pull request #83553 from compnerd/nodiscard
Runtimes: resync from branch (NFCI)
2025-08-07 10:59:59 -07:00
Karoy Lorentey
3e18a07187 [stdlib] Fix implementation of Unicode text segmentation for word boundaries
Carefully overhaul our word breaking implementation to follow the recommendations of Unicode Annex #29. Start exposing the core primitives (as well as `String`-level interfaces), so that folks can prototype proper API for these concepts.

- Fix `_wordIndex(after:)` to always advance forward. It now requires its input index to be on a word boundary. Remove the `@_spi` attribute, exposing it as a (hidden, but) public entry point.
- The old SPIs `_wordIndex(before:)` and `_nearestWordIndex(atOrBelow:)` were irredemably broken; follow the Unicode recommendation for implementing random-access text segmentation and replace them both with a new public `_wordIndex(somewhereAtOrBefore:)` entry pont.
- Expose handcrafted low-level state machines for detecting word boundaries (_WordRecognizer`, `_RandomAccessWordRecognizer`), following the design of `_CharacterRecognizer`.
- Add tests to reliably validate that the two state machine flavors always produce consistent results.

rdar://155482680
2025-08-05 20:04:46 -07:00
Saleem Abdulrasool
e637ccd708 Runtimes: resync from branch (NFCI)
This restores the `LLVM_NODISCARD` macro from the branch point
(retaining the header inclusion changes). This is required to build
SwiftRemoteMirror without injecting another LLVM build.
2025-08-05 16:31:07 -07:00
fahadnayyar
9a01358132 [C++ Interop] Deprecate Optional argument overloads of std.string initializer in Swift’s C++ Stdlib Overlay (#83223)
This patch addresses potential ambiguity and unsafe behavior by
deprecating initializer overloads for `std.string` that accept optional
arguments (`string?`). These overloads previously allowed implicit
initialization from optional pointers (`UnsafePointer<CChar>?`), causing
unclear or unintended behavior.

- Deprecated: `init(_ string: UnsafePointer<CChar>?)`, guiding users
toward the explicit, non-optional initializer.
- Unavailable: `init(_ string: String?)`, explicitly preventing misuse
from optional Swift strings.

rdar://148041893
2025-08-05 15:22:02 -07:00
Adrian Prantl
52fa6a1ceb Merge pull request #82389 from adrian-prantl/153934495
Implement reflection support for Symbolic Extended Existential types.
2025-08-05 09:42:19 -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
David Smith
051d0b68aa Override -_fastUTF8StringContents:utf8Length: to give bridged Strings O(1) access to their UTF8 contents (#83499)
Fixes rdar://157337605
2025-08-04 12:41:51 -07:00
Adrian Prantl
eabcf41a54 Implement reflection support for Symbolic Extended Existential types.
This patch adds a new SymbolicExtendedExistentialTypeRef kind, and
wires it up in TypeDecoder, TypeRefBuilder, TypeLowering, and
ASTDemangler.

This is tested indirectly via the matching LLDB commit.
2025-08-04 08:36:37 -07:00
Alastair Houghton
94058e5e68 [Concurrency] Fix availability problem with UnownedTaskExecutor.
a550080 added a call to the new initializer, but that call
came from a function annotated with `StdlibDeploymentTarget 6.2`,
rather than `SwiftStdlib 6.2`, while the initializer was set to
`SwiftStdlib 6.2`.  This will fail in some build configurations
(specifically where the target being built for is older than that
implied by `SwiftStdlib 6.2`).

rdar://157217460
2025-08-04 14:30:20 +01:00
Alastair Houghton
de3e54a79d Merge pull request #83398 from al45tair/eng/PR-155841439
[Build] Fix deployment version handling for StdlibDeploymentTarget.
2025-08-04 10:54:17 +01:00
eeckstein
8335ce577f Merge pull request #83474 from eeckstein/fix-address-of-property-feature
rename the feature AddressOfProperty to AddressOfProperty2
2025-08-01 17:38:19 +02:00
Ben Rimmington
b57b8368ac [stdlib] Update UTF8Span documentation (#83418)
Amend formatting of `Substring.utf8Span` example code.
Use DocC tables in `Unicode.UTF8.ValidationError` overview.

---------

Co-authored-by: Alex Martini <amartini@apple.com>
2025-08-01 06:56:19 -07:00
Alastair Houghton
857539f3c5 [Build] Fix minimal stdlib build.
We need the new `deployment_version` function to handle the `FREESTANDING`
SDK also.

rdar://155841439
2025-08-01 14:37:34 +01:00
Alastair Houghton
27b1a7d8ee [Build] Fix deployment version handling for StdlibDeploymentTarget.
Where someone has told a target library to build for a _newer_ target
than the current deployment target, we need to respect that newer
target when setting StdlibDeploymentTarget for that target library.

This trips us up when testing against older systems.

rdar://155841439
2025-08-01 12:49:23 +01:00
Max Desiatov
d63bbb9d0c Merge pull request #83456 from MaxDesiatov/enqueue-existential
Embedded WASI: fix some concurrency tests

The test was crashing due to `swift_unreachable("custom executors not supported in embedded Swift")` line in `swift_task_enqueueImpl`, as the corresponding non-embedded codepath was relying on an unspecialized generic function `_swift_task_enqueueOnExecutor` defined in `Executor.swift`. Unspecialized generics are unavailable in Embedded Swift, and such `@silgen_name` function can't be specialized when used from concurrency runtime code written in C/C++. We can redefine this function for Embedded Swift using a class-bound existential instead, and re-enable this codepath with a slightly different call that avoids the use of unavailable `swift_getObjectType` function from the non-embedded runtime.

rdar://156996468
2025-08-01 12:33:51 +01:00
Erik Eckstein
ec8dcc98ad rename the feature AddressOfProperty to AddressOfProperty2
Fixes a build problem when using a mainline compiler with a 6.2 Swift.swiftinterface file.
This was caused by mistakenly cherry-picking the `#if $AddressOfProperty` conditions in the stdlib into 6.2 without the required compiler change.
2025-08-01 08:00:51 +02:00
Allan Shortlidge
fd4df735de Merge pull request #83406 from tshortli/rebaseline-features
AST/ModuleInterface: Re-baseline features
2025-07-31 17:01:17 -07:00
Konrad `ktoso` Malawski
d8cfe92465 Merge pull request #83468 from edymtt/edymtt/no-sized-deallocation-for-compatibility-archives 2025-08-01 06:25:37 +09:00
Max Desiatov
78c85945f6 Actor.cpp: Fix unused variables for non-embedded path 2025-07-31 21:16:40 +01:00
Eric Miotto
988531cc3b CMake: ensure we can build compatibility libraries with macOS 14.0 SDK
In particular, fix the Apple Silicon benchmark job by do not
propagating the flag added in #83399.

Addresses rdar://157188603
2025-07-31 13:12:54 -07:00
Allan Shortlidge
71a5d9bd74 AST: Re-baseline ValueGenericsNameLookup feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
6dd3e49954 AST: Re-baseline BuiltinEmplaceTypedThrows feature. 2025-07-31 10:21:55 -07:00
Alejandro Alonso
e3d381b557 Merge pull request #83397 from Azoy/atomic-addressofrawlayout
[stdlib] Change the builtin used to get the address for Atomic
2025-07-31 09:47:07 -07:00
Max Desiatov
7ec0837778 Embedded WASI: fix concurrency-deleted-method.swift test
The test was crashing due to `swift_unreachable("custom executors not supported in embedded Swift")` line in `swift_task_enqueueImpl`, as the corresponding non-embedded codepath was relying on an unspecialized generic function `_swift_task_enqueueOnExecutor` defined in `Executor.swift`. Unspecialized generics are unavailable in Embedded Swift, and such `@silgen_name` function can't be specialized when used from concurrency runtime code written in C/C++. We can redefine this function for Embedded Swift as using a class-bound existential instead, and re-enable this codepath with a slightly different call that avoids the use of unavailable `swift_getObjectType` function from the non-embedded runtime.
2025-07-31 16:00:40 +01:00