Joe Groff
ba3494802a
Alternative noncopyable switch design based on expression kind.
...
If an expression refers to noncopyable storage, then default to performing
a borrowing switch, where `let` bindings in patterns borrow out of the
matched value. If an expression refers to a temporary value or explicitly
uses the `consume` keyword, then perform a consuming switch, where
`let` bindings take ownership of corresponding parts of the matched value.
Allow `_borrowing` to still be used to explicitly bind a pattern variable
as a borrow, with no-implicit-copy semantics for copyable values.
2024-03-28 08:32:48 -07:00
Johannes Weiss
3f5c3244ce
fix GroupInfo.json: was invalid JSON
2024-03-28 13:07:18 +00:00
Allan Shortlidge
37034282a1
stdlib: Adopt @_disallowFeatureSuppression(NoncopyableGenerics).
...
This prevents some re-declaration errors when building the standard library
from its `.swiftinterface` with older compilers.
2024-03-27 22:20:50 -07:00
Allan Shortlidge
a1dacc12d7
stdlib: Make typed throws ABI placeholders properly @usableFromInline.
...
Functions that are used in public `@inlinable` function bodies can't be marked
`@_spi` nor can they be made obsolete. Also, they must retain `rethrows` so
that use of these entry points from other `rethrows` functions is accepted.
Builds on https://github.com/apple/swift/pull/72365 . Once we no longer have to
support pre-`$TypedThrows` compilers, all of this can be reverted.
Part of rdar://125138945
2024-03-27 14:57:56 -07:00
Alejandro Alonso
8ea3426273
Update comment about arrayDestroy in pointer
2024-03-27 14:02:06 -07:00
Kuba Mracek
37d9be636a
[embedded] Handle NULL IVarDestroyers, expand test
2024-03-26 21:14:21 -07:00
Kuba Mracek
b8bd832fba
[embedded] Add IVarDestroyers into class metadata, add support for throws in initializers
2024-03-26 20:52:17 -07:00
Kuba (Brecka) Mracek
c256c1f594
Merge pull request #72563 from kubamracek/embedded-isUniquelyReferenced_native
...
[embedded] Add swift_isUniquelyReferenced_native into the embedded runtime
2024-03-26 09:16:12 -07:00
Kuba Mracek
8f247e2d36
[embedded] Add swift_isUniquelyReferenced_native into the embedded runtime
2024-03-25 11:51:01 -07:00
Kuba (Brecka) Mracek
89cd62604b
Merge pull request #72472 from kubamracek/embedded-keypaths
...
[embedded] Compile-time (literal) KeyPaths for Embedded Swift
2024-03-25 10:58:51 -07:00
Kuba Mracek
595ea991ce
[embedded] Guard @_transparent in UnsafePointer APIs with #if
2024-03-24 18:12:23 -07:00
Karoy Lorentey
0885068325
[stdlib] Undo the generalization of Result.map & .flatMap for now
...
We didn’t do this for Optional’s equivalent methods yet, so it seems premature to do it for Result.
2024-03-20 18:42:07 -07:00
Kuba Mracek
b642d771be
[embedded] Compile-time (literal) KeyPaths for Embedded Swift
...
Enable KeyPath/AnyKeyPath/PartialKeyPath/WritableKeyPath in Embedded Swift, but
for compile-time use only:
- Add keypath optimizations into the mandatory optimizations pipeline
- Allow keypath optimizations to look through begin_borrow, to make them work
even in OSSA.
- If a use of a KeyPath doesn't optimize away, diagnose in PerformanceDiagnostics
- Make UnsafePointer.pointer(to:) transparent to allow the keypath optimization
to happen in the callers of UnsafePointer.pointer(to:).
2024-03-20 15:35:46 -07:00
Stephen Canon
d24843eea0
Replace two reduces with explicit loops in SIMD implementations. ( #72423 )
...
* Replace two `reduce`s with explicit loops in SIMD implementations.
`reduce` has enough machinery that it pushes us over some inlining thresholds before optimizations happen, resulting in much worse codegen for String breadcrumbs. So a nice pickup there, but also generally applicable to other code as well.
2024-03-20 10:05:35 -04: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
Karoy Lorentey
f24e18cb01
Merge pull request #71688 from lorentey/noncopyable-primitives
...
[stdlib] Start adopting noncopyable generics in the stdlib
2024-03-18 20:45:24 -07:00
Allan Shortlidge
ca925ab379
stdlib: Resolve an un-mutated var warning.
...
NFC.
2024-03-18 16:33:17 -07:00
Karoy Lorentey
e88750eb0c
[stdlib] Apply review notes from @glessard (thanks!)
2024-03-18 11:09:08 -07:00
Guillaume Lessard
3b09ecec74
[gardening] update copyright notice
...
[gardening] update copyright notice
[gardening] update copyright notice
[gardening] update copyright notice
[gardening] update copyright notice
2024-03-18 11:08:32 -07:00
Karoy Lorentey
afa459edd8
[stdlib] ManagedBuffer: Add @_preInverseGenerics for $Embedded
2024-03-18 11:08:32 -07:00
Karoy Lorentey
7d7d7aea1b
[stdlib] Delete leftover workaround
2024-03-18 11:03:49 -07:00
Karoy Lorentey
cf1c92f461
[stdlib] Remove all new public API for now
2024-03-18 11:03:49 -07:00
Karoy Lorentey
38001ae739
[stdlib] Apply @Azoy’s remaining review notes (thanks!)
2024-03-18 11:03:49 -07:00
Karoy Lorentey
2a1f15587e
[stdlib] Use hasFeature(Foo) instead of opaque $Foo syntax
2024-03-18 11:03:49 -07:00
Karoy Lorentey
776ec74dcf
[stdlib] {consuming,borrowing}{Flat,}Map: adopt typed throws
2024-03-18 11:03:49 -07:00
Karoy Lorentey
71519aaf98
[stdlib] Apply minor review notes
2024-03-18 11:03:49 -07:00
Karoy Lorentey
febfd34aac
[stdlib] Make MemoryLayout techically copyable
...
It’s a caseless enum, but there’s no reason to change this aspect of it.
2024-03-18 11:03:49 -07:00
Karoy Lorentey
2d23ab3226
[stdlib] withUnsafePointer: Spell out Error conformance on E
2024-03-18 11:03:49 -07:00
Karoy Lorentey
d70f197c24
[stdlib] Update SwiftStdlibLegacyABI convention to use @available(swift, obsoleted: 1)
...
Using version `2` here is just weird for no reason.
2024-03-18 11:03:49 -07:00
Karoy Lorentey
ce62475cd9
[stdlib] ManagedBuffer: Support for noncopyable Element
...
Header is tricky, but it’s on the TODO list for later.
2024-03-18 11:03:49 -07:00
Karoy Lorentey
d7c402f2f2
[stdlib] Add partial ~Copyable support to withUnsafeTemporaryAllocation facility
...
Generalizing the result type is not yet possible, but T works!
2024-03-18 11:03:49 -07:00
Karoy Lorentey
b83282b689
[stdlib] Temporarily disable round trip validation for debug types
2024-03-18 11:03:49 -07:00
Karoy Lorentey
3507a0cf8c
[stdlib] Add support for noncopyables to withUnsafePointer(to:) family
2024-03-18 11:03:49 -07:00
Karoy Lorentey
285c3d3744
[stdlib] Add support for noncopyables to withExtendedLifetime(of:) family
2024-03-18 11:03:49 -07:00
Karoy Lorentey
72fa98c4b6
[stdlib] Result: Initial support for noncopyable payloads
2024-03-18 11:03:49 -07:00
Karoy Lorentey
3cb9b3383e
[stdlib] Add support for noncopyables to swap(_:_:)
2024-03-18 11:03:49 -07:00
Karoy Lorentey
5ae757181e
[stdlib] UnsafeRawBufferPointer: new interactions with noncopyable types
2024-03-18 11:03:49 -07:00
Karoy Lorentey
d15d5004c8
[stdlib] Unsafe[Mutable]BufferPointer: Add support for non-copyable Pointee types
2024-03-18 11:03:49 -07:00
Karoy Lorentey
78270e1e4e
[stdlib] UnsafePointer: Resolve most of the symbol mismatches
2024-03-18 11:03:49 -07:00
Karoy Lorentey
5ceb055e29
[stdlib] UnsafePointer: Don’t let the compiler synthesize hashValue
2024-03-18 11:03:49 -07:00
Karoy Lorentey
5d90d81dac
[stdlib] Optional: Add @_preInverseGenerics to ExpressibleByNilLiteral conformance
2024-03-18 11:03:49 -07:00
Karoy Lorentey
deda7d6865
[stdlib] UnsafePointer: Add @_preInverseGenerics to _Pointer conformance
2024-03-18 11:03:49 -07:00
Karoy Lorentey
209c66cf74
[stdlib] UnsafePointer: Add @_preInverseGenerics to stored properties
2024-03-18 11:03:49 -07:00
Karoy Lorentey
0a676db16f
[stdlib] Generalize swap(_:_:) for noncopyable types
2024-03-18 11:03:49 -07:00
Karoy Lorentey
805f94b5a8
[stdlib] OpaquePointer: Adopt @_preInverseGenerics
2024-03-18 11:03:49 -07:00
Karoy Lorentey
d6296ab966
[stdlib] UnsafeRawPointer: Adopt @_preInverseGenerics
2024-03-18 11:03:49 -07:00
Karoy Lorentey
baa317c29a
[stdlib] Optional: Adopt @_preInverseGenerics
2024-03-18 11:03:49 -07:00
Karoy Lorentey
56ddafb0a0
[stdlib] UnsafePointer: Adopt @_preInverseGenerics
2024-03-18 11:03:49 -07:00
Karoy Lorentey
bfd2b068c1
[stdlib] MemoryLayout: Adopt @_preInverseGenerics
2024-03-18 11:03:49 -07:00
Karoy Lorentey
7d87ad5a8a
[stdlib] OpaquePointer: new interactions with noncopyable types
2024-03-18 11:03:49 -07:00