Commit Graph

73 Commits

Author SHA1 Message Date
Guillaume Lessard
fab65890fb [stdlib] remove now-unnecessary unsafe annotations 2025-03-01 20:29:11 -08:00
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Doug Gregor
8378562e12 Adopt @unsafe throughout the standard library
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.
2024-08-19 14:33:09 -07:00
Allan Shortlidge
99dbbe4a12 AST: Promote BuiltinStoreRaw feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
20d97556ae stdlib: Remove #if $TypedThrows guards.
https://github.com/swiftlang/swift/pull/72612 can be reverted because it is no
longer necessary for the interface of the stdlib to be compatible with
compilers without `$TypedThrows` support.
2024-07-08 16:52:52 -07:00
Guillaume Lessard
da65626beb Merge pull request #73947 from glessard/rdar128709914 2024-05-29 12:42:55 -07:00
Guillaume Lessard
4fc82f895a [stdlib] remove deprecations added by SE-0426 2024-05-28 11:05:31 -07:00
Guillaume Lessard
71258c4a2a [stdlib] add failure explanations to debug preconditions
addresses rdar://128543858
2024-05-24 14:02:57 -07:00
Nate Chandler
b12def9c6a [BitwiseCopyable] Deprecate unbound overloads.
The unconstrained overloads of loadUnaligned and storeBytes were
deprecated in SE-0426.
2024-04-25 11:44:15 -07:00
Nate Chandler
f9ad81e106 [BitwiseCopyable] Remove #ifs. 2024-04-25 11:44:15 -07:00
Nate Chandler
b1fbe4ea91 [BitwiseCopyable] Remove underscore. 2024-04-25 11:44:15 -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
Karoy Lorentey
e88750eb0c [stdlib] Apply review notes from @glessard (thanks!) 2024-03-18 11:09:08 -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
d6296ab966 [stdlib] UnsafeRawPointer: Adopt @_preInverseGenerics 2024-03-18 11:03:49 -07:00
Karoy Lorentey
0568dbf903 [stdlib] UnsafeRawPointer: new interactions with noncopyable types 2024-03-18 11:03:49 -07:00
Karoy Lorentey
d0b39ac8db [stdlib] Unsafe[Mutable]Pointer: Add support for non-copyable Pointee types
[stdlib] Pull back @_aeic on pointer → integer conversions

[stdlib] UnsafeMutablePointer.allocate: Fix thinko

[stdlib] Disable support for noncopyable pointees on some pointer operations

We have to temporarily pull back support for noncopyable pointees for UnsafeMutablePointer.initialize(to:), .moveInitialize, .moveUpdate, as the builtins they’re calling are no longer accepting such types.

These will return following a builtin audit.

[stdlib] Remove workarounds for certain builtins not supporting noncopyable use

https://github.com/apple/swift/pull/71733 fixed this!

[stdlib] Update FIXME

[stdlib] UnsafePointer: Update Swift version numbers

[stdlib] UnsafePointer: Actually hide legacy ABI

[stdlib] Remove workaround for U[M]BP.withMemoryRebound
2024-03-18 11:03:49 -07:00
Guillaume Lessard
8459d0616d [stdlib] make swiftinterfaces compatible with older toolchains 2024-03-15 16:50:12 -07:00
Guillaume Lessard
6befe66181 [stdlib] convert U[M]R[B]P.withMemoryRebound() to typed throws 2024-03-01 19:07:46 -08:00
Allan Shortlidge
25c0ed6008 stdlib: Avoid condfails resulting from typed throws adoption.
The standard library's swiftinterface must temporarily remain buildable when
`$TypedThrows` evaluates to false since there are still supported Swift 5.11
compilers that did not have the feature enabled by default. Declarations using
typed throws in their signatures are guarded in printed swiftinterface files
with `#if $TypedThrows` and therefore `@inlinable` code that uses those
declarations must also be conditionalized on `$TypedThrows`.
2024-02-21 20:38:39 -08:00
Nate Chandler
1906b28f2b Add missing guard around new builtin.
Avoid a condfail.
2024-02-19 16:04:29 -08:00
Nate Chandler
60d7ff80c7 [stdlib] Used storeRaw for constrained storeBytes.
Implement the overload of storeBytes where value is constrained to
BitwiseCopyable via Builtin.storeRaw.
2024-02-15 18:05:16 -08:00
Nate Chandler
134fc4dfdd [stdlib] BitwiseCopyable storeBytes overload.
The new overload is constrained to BitwiseCopyable and so enjoys the use
of BitwiseCopyableArchetypeTypeInfo.
2024-02-14 13:02:09 -08:00
Nate Chandler
367d71d74f Revert "[stdlib] Uncheck pointers' conf to BitwiseCopyable"
This reverts commit 4dc9713a7a.
2024-01-31 17:11:54 -08:00
Nate Chandler
4dc9713a7a [stdlib] Uncheck pointers' conf to BitwiseCopyable
The pitch calls for such types to obstruct inference of _BitwiseCopyable
in aggregates containing them.
2024-01-30 14:38:07 -08:00
Nate Chandler
b7f5171b83 [stdlib] BitwiseCopyable loadUnaligned overloads.
The new overloads will make use the new BitwiseCopyableArchetypeTypeInfo
to avoid the extra copy that is currently done.
2023-12-05 17:21:05 -08:00
Pavel Yaskevich
a0dfab9ab2 [SE-0331] Mark unsafe pointer conformances to Sendable as explicitly unavailable
This is a preferred way to make sure that Sendable inference doesn't
happen for these types because they are marked as @frozen.
2023-10-10 21:42:46 -07:00
Erik Eckstein
abf9900be7 stdlib: loadUnaligned doesn't need stack protection for it's temporary
rdar://105231457
2023-02-15 08:20:48 +01:00
Guillaume Lessard
2689b6044b Merge pull request #41608 from glessard/se-pointer-family-initialization 2022-09-13 22:00:59 -06:00
Guillaume Lessard
831a87fd36 [stdlib] make additions non-abi 2022-08-26 17:36:40 -06:00
Guillaume Lessard
bef793dd45 [stdlib] add single-element version of initializeMemory to UMRP 2022-08-26 17:36:40 -06:00
Guillaume Lessard
1bba62ec13 Merge pull request #60613 from glessard/pointer-arithmetic-overflow-checks
[stdlib] add overflow checks for some pointer arithmetic
2022-08-25 14:37:44 -06:00
Guillaume Lessard
45b81f6456 [stdlib] add overflow checks for some pointer arithmetic
- Overflow checks added for recent additions to pointer arithmetic (rounding and property pointers).
- The basic `advanced(by:)` functions will need to be dealt with separately.
2022-08-22 09:51:10 -06:00
Guillaume Lessard
92087a8f62 [stdlib] add explanations to _debugPrecondition calls 2022-08-18 15:37:25 -06:00
Guillaume Lessard
bee4eaefc4 Merge pull request #60025 from glessard/rdar96841899
[stdlib] fix unaligned loads of large SIMD vectors on x86_64
2022-07-13 17:04:32 -06:00
Guillaume Lessard
b5cc4121d7 [stdlib] fix unaligned loads of 16-byte (and up) SIMD types
- this is a temporary workaround
2022-07-13 10:29:58 -06:00
Guillaume Lessard
4f87f0caa8 [gardening] fix code indentation 2022-07-12 14:50:17 -06:00
swift-ci
f542ca9a76 Merge pull request #59797 from glessard/aeic-mangled-names
[stdlib] Improve the mangled names of some @_alwaysEmitIntoClient functions
2022-06-29 22:46:23 -07:00
Guillaume Lessard
a74f22dadf [docs] fix a repeated typo 2022-06-29 18:19:34 -06:00
Guillaume Lessard
6d36a36dd9 [stdlib] improve silgen names and better document intention 2022-06-29 16:20:34 -06:00
Steven Wu
ea31a9222f stdlib: Fix the name mangling for UnsafeMutableRawPointer.storeBytes
The name mangling for storeBytes is missing `$`.

rdar://96062712
2022-06-29 09:52:51 -07:00
Guillaume Lessard
3229902990 [stdlib] state clearly the precondition of loadUnaligned 2022-04-14 17:23:53 -06:00
Guillaume Lessard
9716bc5fd2 [stdlib] update UnsafeMutableRawPointer.storeBytes
- preserve previous version for ABI and source stability.
- add new version without alignment restriction.
- add explicit POD type enforcement in new version.
2022-04-14 17:23:53 -06:00
Guillaume Lessard
d9fff5b4ec [stdlib] add unaligned loads to UnsafeRawPointer 2022-04-14 17:23:53 -06:00
Guillaume Lessard
f4d56d3734 Merge pull request #41679 from amartini51/trailing_double_tab
Remove trailing double tabs
2022-03-05 13:16:24 -07:00
Alex Martini
17d3b01b48 Remove trailing double tabs. 2022-03-01 14:46:40 -08:00
Guillaume Lessard
bb05e851af [stdlib] restrict pointer arithmetic to UInt 2022-02-25 13:35:20 -07:00
Guillaume Lessard
b3f96e8cea [stdlib] alignedUp(for:) and siblings for URP and UMRP 2022-02-25 13:34:23 -07:00
Guillaume Lessard
3f67313cce [gardening] formatting adjustments 2022-02-04 16:26:11 -07:00
Guillaume Lessard
245426493c [stdlib] documentation clarifications 2022-02-03 20:02:33 -07:00