Commit Graph

7655 Commits

Author SHA1 Message Date
Guillaume Lessard
484d7c7d46 Merge pull request #82422 from glessard/rdar153219174-UMBP-mutableSpan-62
[stdlib, 6.2] add missing computed properties (again)
2025-06-25 14:44:48 -07:00
Guillaume Lessard
5046c2a529 [stdlib] add UMBP.mutableSpan accessor 2025-06-23 11:20:48 -07:00
Guillaume Lessard
7ee3f85b7e [stdlib] add URMBP.mutableBytes accessor 2025-06-23 11:20:47 -07:00
Egor Zhdan
bf20dab48c Merge pull request #82185 from swiftlang/susmonteiro/6.2-class-metadata-private-fields
🍒 [cxx-interop] Support for printing C++ foreign references
2025-06-23 17:52:00 +01:00
Guillaume Lessard
9de70180f7 Revert "Merge pull request #82284 from glessard/rdar153219174-UMBP-mutableSpan-62"
This reverts commit 845b68a7c4, reversing
changes made to 3d1c592456.
2025-06-18 13:55:44 -07:00
Guillaume Lessard
ea14407cb1 [stdlib] add UMBP.mutableSpan accessor 2025-06-17 15:57:52 -07:00
Guillaume Lessard
7ab45ca442 [stdlib] add URMBP.mutableBytes accessor 2025-06-17 15:57:52 -07:00
Valeriy Van
4e46dc5f3e Fix typo
(cherry picked from commit c14699310f)
2025-06-12 10:05:59 -07:00
susmonteiro
862efcf3a0 [cxx-interop] Support for printing C++ foreign references
Adds support for printing a C++ foreign reference in Swift.

Also skips metadata of private fields in C++ records imported as Swift classes, following up on #81035

(cherry-picked from 848fad0021)
2025-06-11 17:13:01 +01:00
Guillaume Lessard
0130dea4a1 [stdlib] fix small string usage for Substring.utf8Span 2025-06-09 14:19:41 -07:00
Guillaume Lessard
664cc69556 [stdlib] fix small-string usage for String.utf8Span 2025-06-09 14:19:40 -07:00
Guillaume Lessard
9c016215e0 [stdlib] make annotation adjustments 2025-06-09 14:19:38 -07:00
Guillaume Lessard
3a0f890ef0 Merge pull request #80742 from glessard/rdar137710901-addressable-utf8view-span
[6.2, SE-0456] enable span properties for the small-String representation
2025-06-09 14:11:58 -07:00
Doug Gregor
cef7f42a4c Fix more typos 2025-06-05 18:10:53 -07:00
Doug Gregor
999b03a31e Fix typos 2025-06-05 18:10:13 -07:00
Doug Gregor
da6c2c428f Improve SendableMetatype documentation 2025-06-05 16:54:59 -07:00
Guillaume Lessard
6acbdde394 [stdlib] fix an extraneous symbol exported by MutableSpan 2025-05-30 08:23:42 -07:00
Allan Shortlidge
2d96b24e57 Embedded: Suppress spurious unused result warnings.
The results of `swift_retain(object:)` and `swift_bridgeObjectRetain(object:)`
should be discardable since it's typcial to not need the pointer returned from
these calls. Suppresses unused result warnings that were generated previously.
2025-05-19 09:24:53 -07:00
Devin Coughlin
2e941ef2db Merge pull request #81388 from hnrklssn/swiftify-anonymous-params-qual
[Swiftify] Emit @availability when expansions contain Span (#81320)
2025-05-12 17:29:18 -07:00
Nate Cook
c8c035ec32 [6.2][stdlib] Allow a default for optional interpolations (#81360)
Cherry-pick of #80547 for the 6.2 release branch.

---

Explanation: This cherry picks the implementation of SE-0477 to add a
string interpolation method with a `default:` parameter for optional
interpolation values.
Main Branch PR: https://github.com/swiftlang/swift/pull/80547
Risk: Low.
Reviewed By: @stephentyrone 
Resolves: rdar://150865613
Testing: New tests for the string interpolations and fix-its.
2025-05-09 12:10:58 -05:00
Henrik G. Olsson
f70676a340 [Swiftify] Emit @availability when expansions contain Span (#81320)
This prevents errors when compiling for older targets using a newer
compiler.

rdar://150740330
(cherry picked from commit 59d7d3160f)
2025-05-08 16:40:20 -07:00
Guillaume Lessard
8d860936b2 Merge pull request #81225 from glessard/override-lifetime-publicly-6.2
[6.2, stdlib] make _overrideLifetime() functions public
2025-05-08 08:59:21 -07:00
Henrik G. Olsson
6861f2f4e4 [Swiftify] Don't use count from Span inside withUnsafeBufferPointer c… (#81316)
[Swiftify] Don't use count from Span inside withUnsafeBufferPointer c… (#81316)

Given a call like: ptr.withUnsafeBufferPointer { _ptrPtr in ... } ptr.count and _ptrPtr.count both contain the same value, but when ptr is a MutableSpan we get an error when referring to ptr inside a call to withUnsafeMutableBufferPointer, so we should use _ptrPtr.count instead.

rdar://150551109

[Swiftify] add _swiftifyOverrideLifetime for return Spans

std::span imports already have _cxxOverrideLifetime for their return
values. __counted_by needs the same, but Cxx may not be available at the
macro site, so we introduce _swiftifyOverrideLifetime in SwiftifyImport.

rdar://150569220
2025-05-07 21:06:45 -07:00
Guillaume Lessard
2942637f4a [stdlib] remove TODOs
These TODOs aren’t particularly actionable. What we really want is a way to define `_overrideLifetime()` in a not-unsafe way, and that will probably be a `Builtin` operation.
2025-05-07 17:14:08 -07:00
Guillaume Lessard
cae45f1584 [stdlib] make _overrideLifetime functions public
These are discussed in the lifetime annotations pitch: https://github.com/swiftlang/swift-evolution/pull/2750

Addresses rdar://150400414
2025-05-07 17:13:50 -07:00
Michael Gottesman
322a376432 Merge pull request #81334 from gottesmm/release/6.2-rdar150695113
[6.2][swift-settings] Now that we aren't using it immediately, remove it from tree.
2025-05-06 22:41:46 -07:00
Michael Gottesman
e04e15f125 [swift-settings] Now that we aren't using it immediately, remove it from tree.
We can always get it back from the git history.

rdar://150695113
(cherry picked from commit 9d59dbed17)

Conflicts:
	include/swift/AST/DiagnosticsSema.def
	include/swift/Basic/Features.def
	test/abi/macOS/arm64/concurrency.swift
	test/abi/macOS/x86_64/concurrency.swift
2025-05-06 14:12:23 -07:00
Alejandro Alonso
9204a94a62 Merge pull request #81169 from Azoy/wrap-in-feature
[stdlib] Wrap InlineArray inlinable code in new feature
2025-05-05 18:42:52 -07:00
Alejandro Alonso
12919a2300 Merge pull request #78248 from Azoy/value-generic-static-member
[NameLookup] Allow value generics to show up as static members
2025-05-05 18:42:15 -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
Karoy Lorentey
4cde33c4b0 Merge pull request #80867 from lorentey/is_same_metatype_condfail_6.2
[6.2][stdlib] Allow metatype comparisons to work with outdated compilers
2025-05-05 10:03:35 -07:00
Stephen Canon
88e29fafc9 [6.2] Add static .nanoseconds(_: Double) to Duration (#81210) (#81236)
SE-0329 defines the following static factory methods:
```
public static func seconds<T: BinaryInteger>(_ seconds: T) -> Duration
public static func seconds(_ seconds: Double) -> Duration
public static func milliseconds<T: BinaryInteger>(_ milliseconds: T) -> Duration
public static func milliseconds(_ milliseconds: Double) -> Duration
public static func microseconds<T: BinaryInteger>(_ microseconds: T) -> Duration
public static func microseconds(_ microseconds: Double) -> Duration
public static func nanoseconds<T: BinaryInteger>(_ value: T) -> Duration
```
For no good reason, the obvious additional method:
```
public static func nanoseconds(_ nanoseconds: Double) -> Duration
```
was omitted. After talking this through with the LSG, we have decided
that this is simply a bug, and we will add this method without formal
evolution review.
2025-05-02 15:17:45 -07:00
Meghana Gupta
7b0ac8b5b6 Merge pull request #81216 from meg-gupta/fixcowcp
[6.2] Insert end_cow_mutation_addr for lifetime dependent values dependent on mutable addresses
2025-05-01 00:44:41 -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
Meghana Gupta
67b5290ac2 Disable runtime cow verification for mutableSpan property 2025-04-30 14:38:02 -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
Guillaume Lessard
b442d3177b Merge pull request #80740 from glessard/rdar137710901-addressable-span-properties
[6.2, SE-0456, -0467] enable span properties for inline-storage types
2025-04-29 12:29:34 -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
a10356aa27 Merge pull request #80680 from slavapestov/compatibility-span-6.2
[6.2] Cherry-pick recent CompatibilitySpan work
2025-04-23 01:00:29 -04:00
Meghana Gupta
e4b60db09a Merge pull request #80956 from meg-gupta/cposlog
[6.2] Reland #79707
2025-04-22 21:00:05 -07:00
Karoy Lorentey
3fce89c2e8 [stdlib] Allow metatype comparisons to work with outdated compilers
Add a new language feature to avoid the stdlib’s swiftinterface becoming unintelligible to outdated compiler builds due to the generalization of Builtin.is_same_metatype.

rdar://149396721
(cherry picked from commit 0c406b89e6)
2025-04-22 10:02:20 -07:00
Doug Gregor
28d2bef2d1 Merge pull request #80946 from DougGregor/safe-nested-in-unsafe-fixes-6.2
[6.2] [Strict memory safety] Improve handling of safe types nested within unsafe ones
2025-04-21 17:22:13 -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
Meghana Gupta
adb809369f Reland #79707
Revert "Merge pull request #80767 from meg-gupta/reverttransparent"

This reverts commit 198a802719, reversing
changes made to 8eb43af590.
2025-04-21 11:23:00 -07:00
Meghana Gupta
856cbaff9d Add @_transparent to some integer operations in the stdlib
@_transparent will ensure there are inlined in MandatoryInlining which runs before OSLogOptimization.

OSLogOptimization does not look through their calls because they are not marked with
@_semantics("constant_evaluable") which requires them to also be annotated as @_optimize(none)

rdar://148256435
2025-04-21 11:22:26 -07:00
Doug Gregor
3724f84376 [Strict memory safety] Update standard library for nested safe/unsafe types
Use this to mark a few internal types @safe now that it works properly.

(cherry picked from commit 457eb4cc64)
2025-04-21 09:03:30 -07:00
Doug Gregor
469b30334c [Strict memory safety] Remove now-extraneous "unsafe" from the standard libraries
Now that we aren't propagating "unsafe" to nested types, remove
unnecessary "unsafe" keywords from the standard library.

(cherry picked from commit fe6856726e)
2025-04-21 09:03:23 -07:00