Commit Graph

113 Commits

Author SHA1 Message Date
Guillaume Lessard
d03de08221 Merge pull request #83775 from glessard/rdar158440246-62
[stdlib, 6.2.x] guard against deinitializing empty OutputSpan instances
2025-08-22 13:42:00 -07:00
Guillaume Lessard
5e9c3f4a1d [stdlib] guard against underflow 2025-08-16 04:13:15 -07:00
Guillaume Lessard
2c5da55981 [stdlib] fix availability of Span.bytes 2025-07-30 12:55:33 -07:00
Stephen Canon
59e64904dc [6.2] Use unsigned arithmetic for Span bounds checks (#83215)
This allows us to eliminate a comparison;
https://github.com/swiftlang/swift/pull/83172 will allow the compiler to
do it for us instead in the future.

**Explanation:** Changes the implementation of Span's subscript bounds
checks to use a single unsigned comparison instead of two signed
compares.
**Scope:** Narrow. Does not apply to any other API.
**Issues:** rdar://156068535 
**Original PRs:** https://github.com/swiftlang/swift/pull/83150
**Risk:** Low. Minor implementation tweaks to API that is not widely
adopted.
**Testing:** CI
**Reviewers:** @glessard @meg-gupta
2025-07-23 03:38:07 -07:00
Guillaume Lessard
a345e3a8b3 Merge pull request #83000 from glessard/rdar147780495-OutputSpan-updates-62
[SE-0485, 6.2] OutputSpan and OutputRawSpan
2025-07-17 19:12:58 -07:00
Guillaume Lessard
2a88f0e764 [stdlib] add OutputSpan to backdeployment library 2025-07-16 17:19:42 -07:00
Guillaume Lessard
6414aa226f [stdlib] rename RawSpan.extracting functions 2025-07-12 22:58:00 -07:00
Guillaume Lessard
ac3e47612c [stdlib] rename Span.extracting functions 2025-07-12 22:58:00 -07:00
Guillaume Lessard
402a0cf2c8 [stdlib] remove bulk-update from MutableRawSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
34a26d6d9a [stdlib] remove bulk-update from MutableSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
3b4279c671 [stdlib] rename MutableRawSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
05fe6fa522 [stdlib] rename MutableSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
8c7d0db816 [stdlib] make OutputRawSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
f11f3a9b72 [stdlib] make OutputSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
ea4083777b [stdlib] internal UnsafeRawBufferPointer tweaks 2025-07-11 19:03:02 -07:00
Guillaume Lessard
d078734051 [stdlib] InlineArray consumed by OutputSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
42c5988161 [stdlib] add OutputRawSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
850bb23d48 [stdlib] add OutputSpan 2025-07-11 19:03:00 -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
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
74acd4104f [stdlib] fix some unsafe errors 2025-07-07 10:30:37 -07:00
Valeriy Van
4e46dc5f3e Fix typo
(cherry picked from commit c14699310f)
2025-06-12 10:05:59 -07:00
Guillaume Lessard
6acbdde394 [stdlib] fix an extraneous symbol exported by MutableSpan 2025-05-30 08:23:42 -07:00
Doug Gregor
4669daaebd Fix issue with older compilers not handling MutableSpan code
The use of SendableCompletionHandlers here is completely incidental,
because it happened to be introduced at roughly the same time as the
bits we needed for MutableSpan. Fixes rdar://148072153.
2025-05-05 10:22:03 -07:00
Doug Gregor
fcedb0b2a4 Merge pull request #81125 from DougGregor/unsafe-call-effects-6.2
[6.2] [Strict memory safety] Provide argument-specific diagnostics for calls
2025-04-30 15:09:50 -07:00
Guillaume Lessard
c5acba54fa Merge pull request #80777 from glessard/rdar138440979-MutableSpan-mutableBytes
[6.2, SE-0467] add mutableBytes to MutableSpan
2025-04-30 09:46:44 -07:00
Doug Gregor
7f29a27e3d [Strict memory safety] Update standard library for unsafe treated as a call effect
(cherry picked from commit 050a514588)
2025-04-26 07:45:32 -07:00
Andrew Trick
f71b8366e7 Add _overrideLifetime to Span APIs
The implementation previously took advantage of a missing diagnostic. They
returned a borrowed Span with a dependency on a copied argument. This illegally
promotes the dependency. This is what the author intended to do (the
implementation was correct) but the compiler can't know that so the code needs
to be explicit about overriding the lifetime.

(cherry picked from commit e9d11283b9)
2025-04-25 19:21:16 -07:00
Slava Pestov
9dfe53e343 CompatibilitySpan: Fix stdlib build on visionOS
Swift CI tests visionOS, but PR testing does not. Oops.
2025-04-21 15:01:29 -04:00
Slava Pestov
001b1129f7 stdlib: Update {Mutable,}{Raw,}Span availability for backward deployment 2025-04-21 15:01:29 -04:00
Slava Pestov
b3eb1a5bbd CompatibilitySpan: Add MutableRawSpan.swift, MutableSpan.swift 2025-04-21 15:01:28 -04:00
Guillaume Lessard
cb390140d6 [stdlib] correct MutableRawSpan sizing 2025-04-10 10:31:18 -07:00
Guillaume Lessard
53b6b45bda [stdlib] update lifetime annotation syntax 2025-04-10 10:31:18 -07:00
Guillaume Lessard
77431f5217 [stdlib] add MutableSpan.mutableBytes 2025-04-10 10:31:05 -07:00
Meghana Gupta
0c5edc5222 Update stdlib 2025-04-09 10:19:11 -07:00
Allan Shortlidge
d2e8edfc93 stdlib: Address StrictMemorySafety warnings in Span related code. 2025-03-31 16:45:08 -07:00
Guillaume Lessard
c9b1ab8c42 Merge pull request #79650 from glessard/rdar138440979-MutableSpan
[SE-0467] MutableSpan, with mutableSpan properties to Array, ArraySlice and ContiguousArray.
2025-03-28 17:59:47 -07:00
Guillaume Lessard
abf29e7433 [stdlib] adjust MutableSpan’s element constraint 2025-03-27 17:19:15 -07:00
Guillaume Lessard
6a7dbb02f3 [stdlib] update lifetime annotations for Mutable[Raw]Span 2025-03-27 16:55:06 -07:00
Guillaume Lessard
7a160a2dfc [stdlib] de-underscore the extracting() methods 2025-03-27 16:55:05 -07:00
Guillaume Lessard
90684a87a3 [stdlib] add missing unsafe annotations 2025-03-27 13:34:34 -07:00
Guillaume Lessard
5a087d1190 [stdlib] annotate unsafe initializers 2025-03-27 13:34:34 -07:00
Guillaume Lessard
9553982253 [stdlib] use the internal unsafe-unwrap 2025-03-27 13:34:34 -07:00
Guillaume Lessard
4a78667db8 [stdlib] tweaks to MutableRawSpan 2025-03-27 13:34:33 -07:00
Guillaume Lessard
b39ee18f31 [stdlib] tweaks to MutableSpan 2025-03-27 13:34:33 -07:00
Guillaume Lessard
cbbe5df00b [stdlib] add unsafe annotations 2025-03-27 13:34:33 -07:00
Guillaume Lessard
484905b42d [stdlib] add extracting() to MutableSpan and MutableRawSpan 2025-03-27 13:34:32 -07:00
Guillaume Lessard
f214ef29d0 [stdlib] small spelling fixes 2025-03-27 13:34:32 -07:00
Guillaume Lessard
2fa2391c28 [stdlib] remove 2 symbols 2025-03-27 13:34:32 -07:00
Guillaume Lessard
30a3eaec4f [stdlib] add MutableSpan and MutableRawSpan 2025-03-27 13:30:13 -07:00