Commit Graph

125 Commits

Author SHA1 Message Date
Guillaume Lessard 6e140559b8 [stdlib] rephrase some doc-comment notes with active voice 2026-05-12 13:56:51 -07:00
Guillaume Lessard e4db90b222 [stdlib] improve doc-comments for span and bytes properties 2026-05-07 10:29:01 -07:00
Doug Gregor e4512739a8 Fix indentation 2026-04-17 16:04:07 -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
Guillaume Lessard 56f11c1dbd Merge pull request #86571 from glessard/rdar155660454-array-plus-outputspan-followups
[stdlib] followup to #83657
2026-01-20 15:50:31 -08:00
Guillaume Lessard 6daf99b77a [stdlib] add explicit preconditions 2026-01-15 12:51:54 -08:00
Guillaume Lessard 94f5f2d1f5 [stdlib] doc-comment corrections 2026-01-14 16:44:52 -08:00
Guillaume Lessard e334d9c1de Merge pull request #83657 from glessard/rdar155660454-array-plus-outputspan
[stdlib, SE-0485] Array functions with OutputSpan
2026-01-14 14:30:05 -08:00
Guillaume Lessard 58b0e565f0 [stdlib] preserve items appended until a thrown error 2026-01-13 15:00:49 -08:00
Guillaume Lessard 6b0c233042 [stdlib] simplifications 2025-12-27 19:05:15 -08:00
Guillaume Lessard 9e54b6ff3c [stdlib] improve explanatory comment 2025-12-27 19:05:15 -08:00
Guillaume Lessard 3330461baa [stdlib] address some repetition 2025-12-27 19:05:15 -08:00
Guillaume Lessard e5147d1e55 [stdlib] tweak availability for SwiftCompatibilitySpan 2025-12-27 19:05:15 -08:00
Guillaume Lessard 08163e96ad [stdlib] fix doc-comment style 2025-12-27 19:05:15 -08:00
Guillaume Lessard d303e07884 [stdlib] add SE-0485 Array.append with OutputSpan 2025-12-27 19:05:15 -08:00
Guillaume Lessard ccc22ecd01 [stdlib] add SE-0485 Array and ContiguousArray inits 2025-12-27 19:05:15 -08:00
Guillaume Lessard 798b321b28 [stdlib] internal array initializer with OutputSpan 2025-12-27 19:05:15 -08:00
Karoy Lorentey ee14e1fe6d Update stdlib/public/core/Array.swift 2025-12-08 17:39:01 -08:00
Karoy Lorentey fd66cc6af9 Apply suggestions from code review
Co-authored-by: Alex Martini <amartini@apple.com>
2025-12-08 17:39:01 -08:00
Rick van Voorden 048091d6f2 [stdlib] array identical
Co-Authored-By: Ben Rimmington <me@benrimmington.com>
2025-12-08 17:39:01 -08:00
Stephen Canon a1e33e1917 Require that initializedCount is >= 0 in unsafeUninitializedCapacity (#84917)
Resolves: rdar://162669759
2025-10-16 09:04:01 -04:00
Doug Gregor 7088022eef [Standard library] Eliminate ABI-only rethrows versions from Embedded
Where we have rethrowing versions of functions that have typed-throws
counterparts that are only retained for ABI compatibility, wrap them
in `#if !$Embedded` so they aren't compiled into the Embedded version
of the standard library. This eliminates warnings about this code,
which cannot actually be used with arbitrary errors anyway.
2025-09-17 13:09:49 -07:00
Guillaume Lessard d1f7140357 [stdlib] apply the legacy ABI pattern to 3 functions 2025-08-12 16:15:13 -07:00
Guillaume Lessard 3a963a6957 [stdlib] generalize Array(unsafeUninitializedCapacity:initializingWith:) 2025-07-25 09:29:19 -07:00
Guillaume Lessard f97961a86f [stdlib] fix _makeMutableAndUniqueUnchecked() 2025-06-30 16:05:00 -07:00
Guillaume Lessard 4927c0c1c8 [stdlib] improve more accessor declarations 2025-06-26 14:57:21 -07:00
Meghana Gupta ceb3264e40 Disable runtime cow verification for mutableSpan property 2025-04-30 13:38:51 -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
Meghana Gupta ef1e94577f Revert "Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout"
This reverts commit 6eaa07a880, reversing
changes made to e75ee3f4cf.
2025-04-04 09:50:13 -07:00
Artem Chikin 39e1791b67 Revert "Add support for inout lifetime dependence" 2025-04-04 09:00:09 -07:00
Meghana Gupta f4a980d62d Update stdlib 2025-04-03 17:32:09 -07:00
Guillaume Lessard 107b38f9e0 [stdlib] add mutableSpan to array types 2025-03-27 16:55:05 -07:00
Guillaume Lessard ecebaa591e [stdlib] move span properties of array types
…to a more logical spot in each of their files
2025-03-27 14:52:08 -07:00
Guillaume Lessard 940628a23a [stdlib] add newly-required unsafe annotations 2025-03-10 15:20:51 -07:00
Guillaume Lessard 7bbb8348e3 [stdlib] add span properties to array types 2025-03-10 08:51:56 -07:00
Doug Gregor 22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Hamish Knight f1e4fb27de Revert "Add an overload of append(contentsOf:) on Array that takes a Collecti…"
This reverts commit b71f768128.
2024-12-17 16:23:16 +00:00
David Smith b71f768128 Add an overload of append(contentsOf:) on Array that takes a Collection instead of a Sequence, and use it to accelerate wCSIA-compatible Sequences (#77487) 2024-12-13 23:11:35 -08:00
Doug Gregor f8d483da0e Restore comment accidentally removed in typed throws adoption 2024-08-16 14:10:08 -07:00
Doug Gregor 8760b7caad Consistently use @usableFromInline and remove redundant @inlinables 2024-08-16 13:03:07 -07:00
Doug Gregor 4d037ce6ef Adopt typed throws for withUnsafeMutableBufferPointer 2024-08-16 11:13:19 -07:00
Doug Gregor 5c07fd9502 Adopt typed throws in withUnsafeBufferPointer.
Part of rdar://131405937.
2024-08-16 11:13:18 -07:00
Minseong Kim d5bcdca2b6 fix indentation from 1 space to 2 spaces 2024-07-19 16:41:58 +09:00
Erik Eckstein f6a28d81b0 stdlib: enable a check for a special case in Array.append(contentsOf:)
The check for the special case if the sequence is an Array was disabled in embedded swift.
It can be enabled because we now remove the cast after specialization.
Saves some code size when appending one array to another array.
2024-03-19 11:58:16 +01:00
Erik Eckstein 43c4fce773 stdlib: make Array.count an array semantic function
So far the semantic annotation was just added to the internal `_getCount` function.
But for FixedArray it is also required to add the `@_semantics("array.get_count")` to the public API.
2023-12-09 18:49:58 +01:00
Kuba Mracek 9898fc2a27 [embedded] Un-fatalError array to pointer conversion APIs, add test 2023-09-20 15:31:46 -07:00
Kuba Mracek 829967436e [embedded] Simplify AnyObject/Builtin.NativeObject split in arrays by using a typealias 2023-09-16 13:21:46 -07:00
Kuba Mracek ae2e903574 [embedded] Build an initial embedded Swift standard library
This isn't a "complete" port of the standard library for embedded Swift, but
something that should serve as a starting point for further iterations on the
stdlib.

- General CMake logic for building a library as ".swiftmodule only" (ONLY_SWIFTMODULE).
- CMake logic in stdlib/public/core/CMakeLists.txt to start building the embedded stdlib for a handful of hardcoded target triples.
- Lots of annotations throughout the standard library to make types, functions, protocols unavailable in embedded Swift (@_unavailableInEmbedded).
- Mainly this is about stdlib functionality that relies on existentials, type erasure, metatypes, reflection, string interpolations.
- We rely on function body removal of unavailable functions to eliminate the actual problematic SIL code (existentials).
- Many .swift files are not included in the compilation of embedded stdlib at all, to simplify the scope of the annotations.
- EmbeddedStubs.swift is used to stub out (as unavailable and fatalError'd) the missing functionality.
2023-09-16 12:38:46 -07:00
Lucy Satheesan ff76106177 [stdlib] don't copy array contents on removeAll(keepingCapacity: true) 2023-05-24 07:52:39 -07:00
Nate Chandler cda365ca8d [stdlib] Collection types are eagerMove.
Types that have "value semantics" should not have lexical lifetimes.
Value types are not expected to have custom deinits. Are not expected to
expose unsafe interior pointers. And cannot have weak references because
they are structs. Therefore, deinitialization barriers are irrelevant.

rdar://107076869
2023-03-30 11:04:47 -07:00