Commit Graph

21665 Commits

Author SHA1 Message Date
Alejandro Alonso
56bb298d14 Merge pull request #72258 from Azoy/commandline-fixes
[stdlib] Deprecate CommandLine.arguments setter
2024-03-12 16:45:26 -07:00
Allan Shortlidge
32cd086068 Merge pull request #72259 from tshortli/typed-throws-without-actually-escaping
Concurrency: Guard use of `withoutActuallyEscaping()` in inlinable code
2024-03-12 15:12:03 -07:00
Guillaume Lessard
d4abcde64a Merge pull request #72233 from glessard/toplevel-withUUMP-typed-throws
[stdlib] convert `_withUnprotectedUnsafeMutablePointer()` to typed throws
2024-03-12 14:39:46 -07:00
Alejandro Alonso
552edd2ccb Merge pull request #72101 from Azoy/sendable-all-the-things
[stdlib] Sendablize all the things
2024-03-12 13:37:15 -07:00
Mike Ash
133dc5dc55 Merge pull request #72243 from mikeash/dont-log-logd
[Runtime] Don't enable tracing in logd, diagnosticd, notifyd.
2024-03-12 16:04:22 -04:00
Allan Shortlidge
65c0ef830e Concurrency: Guard use of withoutActuallyEscaping() in inlinable code.
Since `withoutActuallyEscaping()` has adopted typed throws, it's no longer
visible to older compilers that do not support typed throws. We need to guard
use of the function in inlinable code to make sure the textual interface of
`_Concurrency` remains buildable with older compilers.

Resolves rdar://124352900
2024-03-12 10:34:57 -07:00
Alejandro Alonso
9d318220b9 Deprecate CommandLine.arguments setter 2024-03-12 09:54:53 -07:00
Alejandro Alonso
17401c627b Remove explicit unavailable sendable from keypath 2024-03-12 09:20:40 -07:00
Konrad `ktoso` Malawski
27702fa115 [Distributed][Macro] Handle more cases in distributed protocol macro (#72177) 2024-03-12 02:12:31 -07:00
Doug Gregor
e0df6e01bd Merge pull request #72234 from DougGregor/attr-implements-assoc-failure-type
[Associated type inference] Support `@_implements` on type witnesses and use it for async sequence `Failure`
2024-03-11 21:03:54 -07:00
Mike Ash
3100be12fa [Runtime] Don't enable tracing in logd, diagnosticd, notifyd.
We can't use os_log functionality in logd, diagnosticd, or notifyd. Check for them and disable tracing in those processes.

Add a new TracingCommon.h for common code shared between swiftCore and swift_Concurrency tracing. Add a single function that checks if tracing should be enabled, which now checks if os_signpost_enabled is available, and if the process is one of these. Modify the tracing code to check this before creating os_log objects.

rdar://124226334
2024-03-11 21:06:15 -04:00
Doug Gregor
5bdd4e5772 Improve @_implements for associated type witnesses
Allow `@_implements` to be expressed in an extension of the protocol in
which the associated type is defined. Use this to uncomment an
intended use of `@_implements` in `Sequence` that could be used to
replace a longstanding hack for associated type inference.

Since this change means that the standard library module interface
won't be accepted by older compilers, introduce a suppressible feature
ssociatedTypeImplements` that covers the use of `@_implements` on type
declarations. This will hide the `@_implements` attribute from older
compilers.
2024-03-11 14:28:20 -07:00
Guillaume Lessard
0ccfa42957 [stdlib] convert _withUnprotectedUnsafeMutablePointer() to typed throws 2024-03-11 11:34:01 -07:00
Arnold Schwaighofer
9639e007d8 Teach TBD that in fragile resilient protocol mode the protocol table is visible 2024-03-11 09:49:38 -07:00
Arnold Schwaighofer
ea70aea43c IRGen: Add code to support building fragile resilient protocol witnesses
We don't currently support building resilient relative protocol witness tables.
One might want to build with relative witness tables but not need
resilient protocols. Allow for that scenario.

Add a test configuration to test library-evolution + fragile resilient
protocols + relative protocol witness tables.
2024-03-10 09:14:08 -07:00
Daniel Rodríguez Troitiño
42e43edef3 [cmake] Unify usage of create_symlink/copy across the build files. (#72202)
In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.

There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.

There's a case for Windows specifically that uses symlinks (in
523f807694/cmake/modules/SwiftConfigureSDK.cmake (L502))
which I have not modified as well.
2024-03-09 18:03:55 -08:00
Guillaume Lessard
78273b2390 Merge pull request #72089 from glessard/toplevel-withUMP-typed-throws
[stdlib] convert `withUnsafeMutablePointer()` to typed throws
2024-03-08 13:52:23 -08:00
Guillaume Lessard
805dd70cfe Merge pull request #72074 from glessard/toplevel-withbytes-typed-throws
[stdlib] convert `withUnsafeBytes()` to typed throws
2024-03-08 08:55:08 -08:00
John McCall
14dcab6bcd Restore (TaskOptionRecordKind)0 to set the initial serial executor.
This has been the behavior of the runtime since the initial release.
Initially, it was thought that task executors would provide similar
functionality, so they naturally took over the enumerator.  After that
changed, we forgot to change it back.  Fortunately, we haven't released
any versions of Swift with the task executors feature yet, so it's not
too late to fix this.
2024-03-08 00:15:10 -05:00
Slava Pestov
123045f825 Merge pull request #71780 from slavapestov/remove-non-experimental-assoc-type-inference
Remove old associated type inference implementation
2024-03-07 22:14:06 -05:00
Meghana Gupta
e96642c219 Merge pull request #72106 from meg-gupta/lifetimedepdiag
Loosen some lifetime dependence diagnostics
2024-03-07 16:32:13 -08:00
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Alastair Houghton
07031a1ab5 [Tests] Fix LongRefcounting test.
We were retaining one too many times in the two `_DeathTest` tests,
which caused the tests to fail.  This was previously masked by a bug.

rdar://124212794
2024-03-07 16:33:49 +00:00
Oscar Byström Ericsson
af0c9fae8e FlattenSequence/distance(from:to:) untrapping Int.min (v6).
1. Put the first region inside the if-else (same branch condition).
2. Use the forward distance in the highest region (as done in the middle).
2024-03-07 13:19:45 +01:00
Meghana Gupta
f3a85b118f Add build-script option and lit config for nonescapable_types
With this build-script has a flag --enable-experimental-nonescpable-types=1
to enable this feature in stdlib.

Also we can now add // REQUIRES: nonescapable_types to tests which run only when
the compiler is built with this feature turned on.
2024-03-06 21:57:03 -08:00
Meghana Gupta
806921c0c8 Allow ~Escapable types to be _BitwiseCopyable 2024-03-06 21:57:03 -08:00
Guillaume Lessard
578a058797 Merge pull request #72052 from glessard/toplevel-withpointer-typed-throws
[stdlib] convert `withUnsafePointer()` to typed throws
2024-03-06 15:01:45 -08:00
Mike Ash
4d484c9f12 Merge pull request #71993 from mikeash/fix-32-bit-unowned-refcount-overflow
[Runtime] Fix strong and unowned refcount overflow on 32-bit.
2024-03-06 17:54:26 -05:00
Nate Chandler
73231b185b [BitwiseCopyable] Don't apply to FixedWidthInteger.
Per LWG feedback.

This reverts commit c8119e3c01.
2024-03-06 08:12:54 -08:00
eeckstein
d1ec089c72 Merge pull request #72088 from language-core/main
chore: fix some comments
2024-03-06 10:08:50 +01:00
Alejandro Alonso
f9f640b141 Sendablize the standard library
oops dont add this flag

no more nonisolated
2024-03-05 15:02:09 -08:00
nate-chandler
ddacabf863 Merge pull request #72083 from nate-chandler/bitwise-copyable/20240304/1
[BitwiseCopyable] Suppress a few conformances.
2024-03-05 13:04:28 -08:00
Allan Shortlidge
a983de3d68 Merge pull request #72062 from tshortli/sendable-sleep-state
Concurrency: Factor atomic operations in `Task.sleep()` into a `Sendable` wrapper
2024-03-05 08:28:31 -08:00
Guillaume Lessard
82ae264b69 [stdlib] convert withUnsafeMutablePointer() to typed throws 2024-03-05 02:48:41 -08:00
Guillaume Lessard
d3cd4985d1 [stdlib] convert withUnsafePointer() to typed throws 2024-03-05 02:31:23 -08:00
Guillaume Lessard
207ae32107 [stdlib] add _withUnprotectedUnsafeMutableBytes() 2024-03-05 02:25:52 -08:00
Guillaume Lessard
528dd0967f [stdlib] convert withUnsafeMutableBytes() to typed throws 2024-03-05 02:12:04 -08:00
Guillaume Lessard
68088bc4e1 [stdlib] convert inout-taking withUnsafeBytes() to typed throws 2024-03-05 02:10:38 -08:00
Guillaume Lessard
f2dcb2f058 [stdlib] convert withUnsafeBytes() to typed throws 2024-03-05 02:10:38 -08:00
cui fliter
127077b3aa chore: fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 17:23:22 +08:00
Guillaume Lessard
8c0db3fe7e Merge pull request #72075 from Catfish-Man/this-pointer-is-raw
Make UnsafeRawBufferPointer.loadUnaligned inlinable to match other pointer load methods
2024-03-04 23:57:21 -08:00
David Smith
753a9408c2 ASCII fast paths for grapheme stride (#72064) 2024-03-04 22:03:58 -08:00
Nate Chandler
621d4c19b2 [stdlib] Suppress Unicode : _BitwiseCopyable.
Mark it always unavailable per LWG feedback.
2024-03-04 16:25:53 -08:00
Nate Chandler
4472178eca [stdlib] Suppress CommandLine : _BitwiseCopyable.
Mark it always unavailable per LWG feedback.
2024-03-04 16:17:06 -08:00
Nate Chandler
fefab495cb [stdlib] Suppress MemoryLayout : _BitwiseCopyable.
Mark it always unavailable per LWG feedback.
2024-03-04 16:04:12 -08:00
David Smith
df8485fe87 Make UnsafeRawBufferPointer.loadUnaligned inlinable to match other pointer load methods 2024-03-04 16:00:15 -08:00
Allan Shortlidge
851b47fbcd Concurrency: Factor atomic operations in Task.sleep() into a Sendable wrapper.
When building the Swift standard library, the compiler warns:

```
warning: capture of 'wordPtr' with non-sendable type 'UnsafeMutablePointer<Builtin.Word>' in a `@Sendable` closure
```

This diagnostic will become an error in the Swift 6 language mode, so it needs
to be addressed. This PR factors the atomic operations used by the
implementation of `Task.sleep()` into an `@unchecked Sendable` wrapper in order
to convince the compiler that these operations are thread-safe. As an added
benefit, the code is more readable when the atomic operatios are abstracted
away. This refactor intentionally translates the existing implementation into a
wrapper as faithfully as possible and does not attempt to improve on any other
aspects of the implementation, such as the unsafe manual memory allocation and
deallocation.
2024-03-04 09:32:28 -08:00
Guillaume Lessard
7cbe2cf4ae Merge pull request #72036 from glessard/rawpointer-withmemoryrebound-typed-throws
[stdlib] convert `U[M]R[B]P.withMemoryRebound()` to typed throws
2024-03-02 13:00:59 -08:00
Guillaume Lessard
6befe66181 [stdlib] convert U[M]R[B]P.withMemoryRebound() to typed throws 2024-03-01 19:07:46 -08:00
Egor Zhdan
f1adf99349 Merge pull request #72012 from apple/egorzhdan/std-chrono
[cxx-interop] Add conversions between `std::chrono::duration` and `Swift.Duration`
2024-03-01 19:17:01 +00:00