16 Commits
Author SHA1 Message Date
Sandeep Vijayarao a46a543feb [TrailingElements] Don't deinitialize elements when the initializer throws
`TrailingArray.init(header:initializingTrailingElementsWith:)` created
the value with just its header, then ran the initializer. If the
initializer threw, the half-built value was destroyed, so `deinit`
deinitialized all `trailingCount` elements, even though the output span
had already deinitialized the ones it had initialized and the rest were
never initialized. `withTemporaryValue(header:initializingTrailingElementsWith:body:)`
had the same problem through the `defer` in `_withTemporaryValue`. With
non-trivial elements (e.g. class references) both crashed.

Initialize the trailing elements before creating the `TrailingArray`,
and if the initializer throws, only deinitialize the header (and free the
heap storage) before rethrowing.
2026-11-11 00:24:31 -08:00
Karoy Lorentey 1b936eda0b Disable strict memory safety on older toolchains
It would take too much effort to try to mitigate stdlib differences.

Fix low-hanging warnings, but turn off `.strictMemorySafety` on older toolchains by splitting the package manifest.
2026-10-01 13:40:27 -07:00
Karoy Lorentey d07dc32dfa Sources: Add unsafe keywords where needed 2026-10-01 11:14:29 -07:00
Karoy Lorentey 537bf9cbfb Drop support for Swift 6.0 and 6.1
This allows the use of Span types without `#if compiler` guards.
2026-09-21 13:34:39 -07:00
Karoy Lorentey 842f125c47 Invert dependencies to ContainersPreview, moving all container APIs there
- Move `InputSpan` into its own module, `SpanPreview`. Add dependencies to it.
- Invert dependencies to `ContainersPreview`, so that no production target imports it, but it now depends on its previous dependents.
- Move all generic APIs and conformances using `Producer`/`Drain`/`Container` to the `ContainersPreview` module.
- Remove `UnstableContainersPreview` conditions around `Iterable` APIs

In summary, importing `BasicContainers` and `DequeModule` continue to get us the basic definitions for `RigidArray`, `UniqueSet`, `RigidDeque` etc., without most of their unstable APIs. (With the exception of core APIs that require `InputSpan`.)

To get any API that uses an unstable protocol like `Container` or `Drain`, we’ll now need to import `ContainersPreview` in addition to the type-defining module.

This will provide a slightly less horrible migration path when (if) the container/producer protocol family gets adopted/adapted into the stdlib.
2026-08-25 18:29:58 -07:00
wjdtjq6 62a08e503e docs: fix typos in doc comments and DocC article 2026-07-02 21:17:11 +09:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Karoy Lorentey 1dc2b7717f Revert "Don’t allow backdeployment of any Span types below the most recent Darwin OS releases"
This reverts commit 485e69bfb1.

# Conflicts:
#	CMakeLists.txt
2025-09-27 12:15:30 -07:00
Karoy Lorentey 485e69bfb1 Don’t allow backdeployment of any Span types below the most recent Darwin OS releases
References to Span types trigger an issue where SwiftPM isn’t able to run command line executable targets or tests on older OSes.

Set the availability of everything that needs span types to the most recent Apple OS releases.

Hopefully we’ll be able to revert this once we figure out a better workaround.
2025-09-26 22:38:18 -07:00
Karoy Lorentey 31d3abcc22 Reindent TrailingElementsModule 2025-09-26 22:38:16 -07:00
Karoy Lorentey 346934794a Add package-wide source file header to TrailingElementsModule components 2025-09-26 18:53:13 -07:00
Doug Gregor 43367db377 [TrailingArray] Handle trailing arrays where the element has greater alignment than the header
When this happens, we over-allocate and use the alignment of the
elements, and then move the start of the header after the point of
allocation such that the properly-aligned elements follow it
immediately.
2025-09-12 11:23:07 -07:00
Doug Gregor aa36f635ad Rename PaddedStorage to TrailingPadding 2025-09-08 18:59:45 -07:00
Doug Gregor e08ba6087d [TrailingElementsModule] Rename "takePointer" to "leakStorage", which is more descriptive 2025-09-08 18:56:51 -07:00
Doug Gregor b6208a9836 Rename IntrusiveManagedBuffer to TrailingArray 2025-09-08 18:54:48 -07:00