Commit Graph

7470 Commits

Author SHA1 Message Date
Doug Gregor
733dd86c92 Merge pull request #79896 from DougGregor/strict-memory-safety-cleanups
Strict memory safety cleanups
2025-03-11 01:26:30 -07:00
Michael Gottesman
04bb69f426 Merge pull request #79727 from gottesmm/pr-025c1133954b74e7b4eda77e1a6f3bcafd4eb6cf
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
2025-03-10 22:35:00 -07:00
Michael Gottesman
f64dd5a8d5 [concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
Doug Gregor
f668feaf64 [Standard library] Additional strict-memory-safety annotations 2025-03-10 15:42:05 -07:00
Guillaume Lessard
7214717fba Merge pull request #79708 from glessard/span-gardening
[SE-0447] Span and RawSpan tests
2025-03-07 22:00:58 -08:00
nate-chandler
c0ba520fac Merge pull request #79781 from nate-chandler/general-coro/20250227/1
[CoroutineAccessors] Dispatch and PtrAuth.
2025-03-07 20:08:42 -08:00
Ben Rimmington
e5487d86f0 Merge pull request #79800 from benrimmington/inline-array
[stdlib] Update `InlineArray`
2025-03-08 02:32:44 +00:00
Guillaume Lessard
4ec8c6e345 [stdlib] document unsafe behaviour for empty spans 2025-03-07 13:23:25 -08:00
Guillaume Lessard
3bd04acadb Apply suggestions from code review 2025-03-07 13:23:25 -08:00
Guillaume Lessard
5f24c66ea7 [stdlib] define properties also for ~Escapable elements
These should be available for any type of element `Span` can have in the future, including non-escapable elements. Making this change now avoids future churn.

Addresses rdar://146130842
2025-03-07 13:23:24 -08:00
Evan Wilde
28f96411c9 Merge pull request #79778 from etcwilde/ewilde/yo-dawg-heard-you-liked-swift
CMake: option to disable swift in swift
2025-03-07 13:12:00 -08:00
Ben Rimmington
aa64816b98 Merge branch 'main' into inline-array 2025-03-07 20:31:04 +00:00
Guillaume Lessard
077a01f807 Merge pull request #79813 from glessard/unchecked-bounds-are-unsafe
[stdlib] Unchecked bounds are unsafe
2025-03-07 12:20:05 -08:00
Nate Chandler
35d06c325d [CoroutineAccessors] Witness and vtable dispatch.
And thunking.
2025-03-07 11:46:50 -08:00
Evan Wilde
ddaf003c56 Get stdlib building again
PR 79186 (https://github.com/swiftlang/swift/pull/79186) moved one of
the mandatory passes from the C++ implementation to the Swift
implementation resulting in a compiler that is unable to build the
standard library. The pass used to ensure that inaccessible control-flow
positions after an infinite loop was marked with `unreachable` in SIL.
Since the pass is no longer running, any function that returns a value
that also has an infinite loop internally must place a fatalError after
the infinite loop or it will fail to compile as the compiler will
determine that the function does not return from all control flow paths
even though some of the paths are unreachable.
2025-03-06 13:32:54 -08:00
Doug Gregor
0ec13f9a90 Build compiler and runtimes without Swift
Remove dependency on macros from compiler and stdlib build when
bootstrapping the compiler without Swift available.
2025-03-06 13:32:52 -08:00
Ben Rimmington
30e167b499 [stdlib] Add unchecked subscript to InlineArray 2025-03-06 19:25:50 +00:00
Ben Rimmington
d0bab4082d [stdlib] Add isEmpty property to InlineArray 2025-03-06 19:25:50 +00:00
Ben Rimmington
428d269a18 [stdlib] Use Index typealias of InlineArray 2025-03-06 19:25:50 +00:00
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
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