Ben Rimmington
23e1741978
[stdlib] Update doc comments of InlineArray
...
- Write an overview of the type.
- Amend summaries of the initializers.
- Remove inapplicable example code.
- Add "Complexity: O(*n*)" to initializers.
- Add "Complexity: O(1)" to indexing APIs.
- Add FIXME comments.
2025-03-06 19:25:50 +00:00
Guillaume Lessard
dfb2e2f12e
[stdlib] annotate uses of Range.init(_uncheckedBounds:)
2025-03-05 18:52:11 -08:00
Guillaume Lessard
eed9c46116
[stdlib] mark _uncheckedBounds range inits as unsafe
2025-03-05 18:51:27 -08:00
Guillaume Lessard
66adb21502
[stdlib] annotate Span and RawSpan unsafe initializers
2025-03-05 17:15:03 -08:00
Guillaume Lessard
bd32aa5f6e
[stdlib] remove an extracting overload
...
- `RangeExpression` implicitly involves bounds checking, so this was misleading.
2025-03-05 17:15:03 -08:00
Guillaume Lessard
712c79c711
[gardening] 80-column vigilance
2025-03-05 16:28:11 -08:00
Guillaume Lessard
1c1a845d67
[stdlib] fix withUnsafe[BufferPointer,Bytes] impls
2025-03-05 16:28:11 -08:00
Guillaume Lessard
10a0ee212e
[stdlib] add an _extracting() overload for ClosedRange
2025-03-05 16:28:11 -08:00
Guillaume Lessard
928cbeac43
[stdlib] adjust failure messages (and spellings)
2025-03-05 16:28:11 -08:00
Guillaume Lessard
89956e71ec
[stdlib] use the Index typealias in Span
...
- these were missed in a previous code change
2025-03-05 16:28:11 -08:00
Guillaume Lessard
6802d22dc3
[stdlib] Update availability annotations for Span
2025-03-05 16:28:11 -08:00
Kuba (Brecka) Mracek
7710a97ccb
Merge pull request #79698 from kubamracek/embedded-more-traps-stringinterp
...
[embedded] Allow string-interpolatings in assert, assertionFailure, precondition, preconditionFailure
2025-03-05 09:22:09 -08:00
Henrik G. Olsson
27a29c0baf
[Swiftify][StrictMemorySafety] Test unsafe warnings in wrappers (NFC) ( #79719 )
...
[Swiftify][StrictMemorySafety] Test `unsafe` warnings in wrappers (NFC)
As _SwiftifyImport now emits the `unsafe` keyword to prevent warnings
about unsafe code in the macro expansions, we should make sure that our
tests do not emit any warnings. It turns out that calls to
RawSpan::withUnsafeRawPointer are not recognised as unsafe, so we
sometimes get warnings about using `unsafe` on a safe expression. This
issue is tracked under rdar://145899513.
2025-03-03 17:56:12 -08:00
Meghana Gupta
cf6c4c9422
Merge pull request #79699 from meg-gupta/prboundscheck
...
Add support for bounds check optimization of Span and InlineArray
2025-03-03 14:32:27 -08:00
Jonathan Grynspan
9489564e07
Just like #76041 , but for ~Escapable instead of ~Copyable.
...
Resolves rdar://145945680.
2025-03-03 14:06:30 -05:00
Guillaume Lessard
7899343f40
Merge pull request #79732 from glessard/integers-are-safe
...
[stdlib] Integers are safe
2025-03-02 16:27:50 -08:00
Guillaume Lessard
fab65890fb
[stdlib] remove now-unnecessary unsafe annotations
2025-03-01 20:29:11 -08:00
Guillaume Lessard
b9dd255e08
[stdlib] converting an address to an integer is safe
2025-03-01 20:28:12 -08:00
Meghana Gupta
1fd2689985
Remove Span._checkIndex overload
2025-02-28 19:12:03 -08:00
Kuba Mracek
40aea83c6b
[embedded] Allow string-interpolatings in assert, assertionFailure, precondition, preconditionFailure
2025-02-28 18:47:47 -08:00
Meghana Gupta
4edaaa4dcc
Remove @_transparent from InlineArray.count
...
It is orthogonal to @_semantics. @_transparent annotated functions need to be
inlined early and @_semantics annotated functions need to be inlined late.
Remove @_transparent since it has no effect here.
2025-02-28 09:52:02 -08:00
Meghana Gupta
6908e9b776
Annotate some Span and InlineArray's methods with semantics
2025-02-28 09:52:00 -08:00
Kuba Mracek
01d7e231c3
[embedded] Allow string-interpolating fatalError in Embedded Swift
2025-02-28 08:53:09 -08:00
Doug Gregor
22eecacc35
Adopt unsafe annotations throughout the standard library
2025-02-26 14:28:01 -08:00
Doug Gregor
50d3913086
[SE-0458] Enable strict memory safety in the Swift standard library
2025-02-26 14:27:55 -08:00
Anthony Latsis
e0cf5a50b6
Merge pull request #77639 from honghoker/fix/typo
...
Fix missing whitespace in Swift special comments
2025-02-24 22:08:34 +00:00
Alex Martini
f89472ed1a
Merge pull request #79410 from amartini51/error_kind_41136833
...
Remove redundant word "error" from type name
Fixes: rdar://41136833
2025-02-21 10:40:12 -08:00
honghoker
7e30a91e47
fix: add missing whitespace in MARK comment
2025-02-20 21:57:08 +09:00
Alejandro Alonso
ff58dc6739
Use other feature syntax
2025-02-17 14:50:42 -08:00
Alejandro Alonso
7480668c7b
Add feature for Builtin.emplace typed throws
2025-02-17 12:45:05 -08:00
Alex Martini
3c21c626be
Remove redundant 'error' from type name
2025-02-14 17:07:52 -08:00
Doug Gregor
2989770cd6
Merge pull request #79352 from DougGregor/strict-sendable-metatypes
...
Add StrictSendableMetatypes to require Sendable requirements on metatypes
2025-02-14 03:40:36 -08:00
Doug Gregor
e24598bca1
Use a marker protocol SendableMetatype to model T.Type: Sendable
...
Introduce a marker protocol SendableMetatype that is used to indicate
when the metatype of a type will conform to Sendable. Specifically,
`T: SendableMetatype` implies `T.Type: Sendable`. When strict
metatype sendability is enabled, metatypes are only sendable when `T:
SendableMetatype`.
All nominal types implicitly conform to `SendableMetatype`, as do the
various builtin types, function types, etc. The `Sendable` marker
protocol now inherits from `SendableMetatype`, so that `T: Sendable`
implies `T.Type: Sendable`.
Thank you Slava for the excellent idea!
2025-02-13 22:48:05 -08:00
Philipp Gabriel
773561cc27
Expose attosecond representation of Duration ( #78202 )
...
* Add Int128 to Duration
* Update stdlib/public/core/Duration.swift
Co-authored-by: Stephen Canon <stephentyrone@gmail.com >
* Add unit tests for duration + attoseconds
* Add docs to duration + attosecond
* Update docs for attoseconds property
* Update stdlib.swift
* Update stdlib.swift
---------
Co-authored-by: Stephen Canon <stephentyrone@gmail.com >
2025-02-13 09:31:02 -05:00
Guillaume Lessard
c7af9a701b
Merge pull request #79294 from Azoy/bye-bye-slab
...
[stdlib] Rename Slab to InlineArray
2025-02-12 12:03:25 -08:00
Erik Eckstein
6407f9a0bd
remove the allocVector builtin
...
It's not needed anymore, because the "FixedArray" experimental feature is replaced by inline-arrays.
2025-02-12 10:51:14 +01:00
Alejandro Alonso
e4fb1f6761
Rename Slab to InlineArray
2025-02-11 10:26:44 -08:00
Alejandro Alonso
f38e84cfe1
Pass buffer to _projectReadOnly and fix appends
2025-02-05 14:33:30 -08:00
Alejandro Alonso
90bd2a008e
Add maxSize helper to buffer and fix reroot
2025-02-04 16:21:09 -08:00
Alejandro Alonso
edee13a612
Take the leaf type into account for max size
2025-02-04 15:16:40 -08:00
Alejandro Alonso
59c53b72f0
Don't do the kvc stored offset optimization on 16 bit platforms
2025-02-04 15:16:40 -08:00
Alejandro Alonso
02401d4bb0
Remove some workarounds
2025-02-04 15:16:39 -08:00
Alejandro Alonso
581376e86e
Move variable into closure
2025-02-04 15:16:39 -08:00
Alejandro Alonso
25a4bbe549
Check maxSize on finish
2025-02-04 15:16:39 -08:00
Alejandro Alonso
6fdb684fd2
Optimization for single component and fix tests
2025-02-04 15:16:39 -08:00
Alejandro Alonso
00ace6695f
Round up sizeWithMaxSize
2025-02-04 15:16:38 -08:00
Alejandro Alonso
4733da2744
Performance improvements for reading keypaths
2025-02-04 15:16:36 -08:00
Kuba (Brecka) Mracek
3afe8ebdf6
Merge pull request #78919 from kubamracek/embedded-dict-init
...
[embedded] Support Dictionary.init(uniqueKeysWithValues:) in Embedded Swift
2025-01-31 11:03:04 -08:00
Erik Eckstein
20db2a488b
stdlib: add a missing fixLifetime in withVaList
...
If this function is inlined, the optimizer can shrink the lifetime of the `args` parameter. This would deallocate the passed arguments (e.g. `NSString`s) before the are used in the closure.
2025-01-30 17:30:22 -08:00
Gábor Horváth
8462105e29
Merge pull request #78947 from swiftlang/gaborh/lifetimebound-this
2025-01-29 09:09:53 +00:00