Skip to content

Generalize Data's withUnsafe[Mutable]Bytes functions#1622

Merged
glessard merged 3 commits intoswiftlang:mainfrom
glessard:data+generalized-with-unsafe-bytes
Mar 24, 2026
Merged

Generalize Data's withUnsafe[Mutable]Bytes functions#1622
glessard merged 3 commits intoswiftlang:mainfrom
glessard:data+generalized-with-unsafe-bytes

Conversation

@glessard
Copy link
Copy Markdown
Contributor

@glessard glessard commented Dec 4, 2025

  • Support typed throws
  • Support non-copyable return values

@glessard glessard requested a review from jmschonfeld December 4, 2025 22:50
@glessard
Copy link
Copy Markdown
Contributor Author

glessard commented Dec 4, 2025

@swift-ci please test

Comment thread Sources/FoundationEssentials/Data/Representations/Data+Inline.swift
Comment thread Sources/FoundationEssentials/Data/Representations/Data+Inline.swift Outdated
@glessard
Copy link
Copy Markdown
Contributor Author

glessard commented Dec 5, 2025

@swift-ci please test

1 similar comment
@glessard
Copy link
Copy Markdown
Contributor Author

glessard commented Dec 5, 2025

@swift-ci please test

Comment thread Tests/FoundationEssentialsTests/DataLegacyABITests.swift Outdated
Comment thread Tests/FoundationEssentialsTests/DataTests.swift Outdated
@glessard
Copy link
Copy Markdown
Contributor Author

glessard commented Dec 5, 2025

@swift-ci please test

@glessard
Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@glessard glessard force-pushed the data+generalized-with-unsafe-bytes branch from c6f7a4f to 6ab735c Compare December 11, 2025 20:01
@glessard
Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@glessard glessard added the API Change Any changes to Foundation's public API surface label Dec 11, 2025
Tweak a test (silence a warning)

Generalize Data’s `withUnsafeMutableBytes` functions

Test generalized functions

Only compile old ABI for FOUNDATION_FRAMEWORK

Verify the old ABI

Spell `rethrows` as `throws` in ABI-compatibility functions

Improve test by using a more specific #expect

Add a test suite specifically for legacy ABI tests

Generalize `withContiguousStorageIfAvailable` as well
@jmschonfeld jmschonfeld force-pushed the data+generalized-with-unsafe-bytes branch from 6ab735c to db58f28 Compare March 10, 2026 18:20
@jmschonfeld jmschonfeld requested a review from a team as a code owner March 10, 2026 18:20
@itingliu
Copy link
Copy Markdown
Contributor

@swift-ci please test

- Use `@inline(__always)` with `@_aeic`
- Use DATA_LEGACY_ABI instead of FOUNDATION_FRAMEWORK. They have different semantics. Targets requiring data legacy ABI don't always build with FOUNDATION_FRAMEWORK.
- Fix copy pasta errors in tests.
@itingliu
Copy link
Copy Markdown
Contributor

@swift-ci please test

Comment thread Tests/FoundationEssentialsTests/DataLegacyABITests.swift Outdated
@glessard
Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@glessard glessard merged commit 730ccca into swiftlang:main Mar 24, 2026
40 of 41 checks passed
@glessard glessard deleted the data+generalized-with-unsafe-bytes branch March 24, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Change Any changes to Foundation's public API surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants