Commit Graph

45907 Commits

Author SHA1 Message Date
Mike Ash
2452f27e0f [6.2][RemoteMirror] Only look through Task wait adapters when there's a dependency record.
When the RunJob pointer is set to adapters, we try to get the "real" run pointer from the context. However, there are cases where the context can be a dangling pointer, when the task has finished with it but hasn't reset the pointer to anything else. For cases where that can happen, the context is legitimate only when there's a dependency record. Check for a dependency record before trying to read the context in those cases.

In most uses this will fail gracefully or return a garbage run pointer, but swift-reflection-test uses an in-process memory reader which can crash when trying to chase this pointer, resulting in test failures.

rdar://149252404
(cherry picked from commit 027cc09c2d)
2025-04-25 09:16:00 -04:00
Michael Gottesman
da57f9665c Merge pull request #80953 from gottesmm/release/6.2-135459885
[6.2][sil-isolation-info] When determining isolation of a function arg, use its VarDecl.
2025-04-24 10:14:41 -07:00
nate-chandler
e2d59bdb5b Merge pull request #81044 from nate-chandler/rdar141279635
6.2: [MoveOnly] Fix consumption of opened existentials.
2025-04-23 20:53:04 -07:00
nate-chandler
05b997d9aa Merge pull request #81013 from nate-chandler/cherrypick/release/6.2/rdar147586673
6.2: [OSSACanOwned] Don't dead-end extend if consumed.
2025-04-23 15:40:54 -07:00
Slava Pestov
eaa49f6a84 Demangle: Implement missing Node::Kind::DependentProtocolConformanceOpaque
If a retroactive conformance is conditional and the subject type of a
conditional requirement is an opaque archetype, the mangler would
emit a mangling using the "HO" operator which the demangler did not
understand.

Implement de/remangler support for the "HO" operator.

Fixes rdar://149801864.
2025-04-23 16:40:46 -04:00
Nate Chandler
b794e21dd3 [SIL] Add open_existential_addr.accessKind setter. 2025-04-23 13:28:49 -07:00
Anthony Latsis
f4d323bdbf AST: Quote attributes more consistently in DiagnosticsSIL.def 2025-04-23 19:18:11 +01:00
Anthony Latsis
cdae255f9f AST: Quote attributes more consistently in DiagnosticsModuleDiffer.def 2025-04-23 19:18:11 +01:00
Anthony Latsis
735b24af28 AST: Quote attributes more consistently in DiagnosticsIRGen.def 2025-04-23 19:18:11 +01:00
Anthony Latsis
6e94080c93 AST: Quote attributes more consistently in DiagnosticsCommon.def 2025-04-23 19:18:11 +01:00
Anthony Latsis
7b92a8f041 AST: Quote attributes more consistently in DiagnosticsParse.def 2025-04-23 19:18:11 +01:00
Anthony Latsis
5e41794680 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-23 19:18:08 +01:00
Slava Pestov
a10356aa27 Merge pull request #80680 from slavapestov/compatibility-span-6.2
[6.2] Cherry-pick recent CompatibilitySpan work
2025-04-23 01:00:29 -04:00
Doug Gregor
172229eea9 Merge pull request #80988 from DougGregor/new-diagnostics-formatter-without-sourceloc-6.2 2025-04-22 20:39:31 -07:00
Allan Shortlidge
5a557d5261 Merge pull request #80996 from tshortli/member-import-visibility-cross-import-overlay-6.2
[6.2] Sema: Improve MemberImportVisibility diagnostics for cross import overlays
2025-04-22 18:18:04 -07:00
Nate Chandler
f2a00f0fcb [OSSACanOwned] Don't dead-end extend if consumed.
When the utility is used by the ConsumeOperatorCopyableValuesChecker,
the checker guarantees that the lifetime can end at the consumes, that
there are no uses after those consumes.  In that circumstance, the
utility maintains liveness to those consumes and as far as possible
without introducing a copy everywhere else.

The lack of complete lifetimes has forced the utility to extend liveness
of values to dead-ends.  That extension, however, is in tension with the
use that the checker is putting the utility to.  If there is a dead-end
after a consume, liveness must not be maintained to that dead-end.

rdar://147586673
2025-04-22 16:49:42 -07:00
Nate Chandler
19242dffde [NFC] OSSACanOwned: Extracted predicate. 2025-04-22 16:49:42 -07:00
Nate Chandler
6b977dc43b [NFC] OSSACanOwned: Renamed field. 2025-04-22 16:49:41 -07:00
Pavel Yaskevich
af01ed473a Merge pull request #80982 from xedin/rdar-145776322-6.2
[6.2][Frontend] Promote `AsyncCallerExecution` to an upcoming feature
2025-04-22 15:51:36 -07:00
Mike Ash
36d67e990f Merge pull request #80949 from mikeash/function-cast-6.2
[6.2][Runtime] Add function_cast, switch from std::bit_cast.
2025-04-22 16:25:06 -04:00
Allan Shortlidge
43fd131762 Sema: Improve MemberImportVisibility diagnostics for cross import overlays.
When `MemberImportVisibility` is enabled and a declaration from a cross import
overlay is diagnosed because it has not been imported, suggest imports of the
declaring and bystanding modules instead of the cross import overlay module
(which is an implementation detail).

Resolves rdar://149307959.
2025-04-22 10:09:24 -07:00
Karoy Lorentey
3fce89c2e8 [stdlib] Allow metatype comparisons to work with outdated compilers
Add a new language feature to avoid the stdlib’s swiftinterface becoming unintelligible to outdated compiler builds due to the generalization of Builtin.is_same_metatype.

rdar://149396721
(cherry picked from commit 0c406b89e6)
2025-04-22 10:02:20 -07:00
Doug Gregor
3ecd05593e [Diagnostics] Use the swift-syntax formatting for invalid source locations, too
The diagnostics formatter from swift-syntax previously only handled
fully-formed diagnostics anchored at a particular syntax node.
Therefore, the compiler would fall back to the existing LLVM-based
diagnostic formatter for diagnostics that had no source location.

Adopt new API in the swift-syntax diagnostics formatter that renders a
diagnostic message without requiring source location information, so
that we consistently use the swift-syntax formatter when it is
selected (which is the default).

(cherry picked from commit 235242e8b3)
2025-04-22 07:00:11 -07:00
Pavel Yaskevich
d007d7adfb [Frontend] Rename AsyncCallerExecution upcoming feature to NonisolatedNonsendingBeDefault
(cherry picked from commit c110941c27)
2025-04-22 00:33:45 -07:00
Pavel Yaskevich
c856f52f1e [Frontend] Mark AsyncCallerExecution as an upcoming feature in Swift 7
(cherry picked from commit a3d35d54e5)
2025-04-22 00:32:35 -07:00
Doug Gregor
28d2bef2d1 Merge pull request #80946 from DougGregor/safe-nested-in-unsafe-fixes-6.2
[6.2] [Strict memory safety] Improve handling of safe types nested within unsafe ones
2025-04-21 17:22:13 -07:00
QuietMisdreavus
61c4a0311f [6.2] [SymbolGraphGen] add flags to filter platforms out of availability metadata (#80806)
rdar://144379124
2025-04-21 14:48:43 -06:00
Slava Pestov
fb5e67abc6 Update RuntimeVersions.def for Swift 6.1 2025-04-21 15:01:28 -04:00
Michael Gottesman
636aa31192 [sil-isolation-info] When determining isolation of a function arg, use its VarDecl.
Otherwise, we can be inconsistent with isolations returned by other parts of the
code. Previously we were just treating it always as self + nom decl, which is
clearly wrong if a type is not self (e.x.: if it is an isolated parameter).

rdar://135459885
(cherry picked from commit 0ece31e4f6)
2025-04-21 10:57:48 -07:00
Mike Ash
b2d6514b63 [6.2][Runtime] Add function_cast, switch from std::bit_cast.
Function types aren't always trivially copyable, e.g. with address-discriminated signed pointers on ARM64e. Introduce a function_cast helper and use that instead.

(cherry picked from commit 185b739cf1)
2025-04-21 12:47:48 -04:00
Doug Gregor
ac56b63bd3 [Strict memory safety] Type alias types are only unsafe if their underlying type is
(cherry picked from commit 53ca902267)
2025-04-21 09:03:28 -07:00
Hamish Knight
32a0454d92 Merge pull request #80910 from hamishknight/macro-async-warning-6.2
[6.2] [Sema] Downgrade `noasync` diagnostic to warning for closure macro args
2025-04-19 02:18:18 +01:00
Pavel Yaskevich
c18e23193e Merge pull request #80892 from xedin/fix-printing-of-specifiers-and-attributes-6.2
[6.2][AST] ASTPrinter: Improvements to specifier and attribute printing
2025-04-18 09:07:02 -07:00
Hamish Knight
b2b37eb766 [Sema] Downgrade noasync diagnostic to warning for closure macro args
Downgrade to a warning until the next language mode. This is
necessary since we previously missed coercing macro arguments to
parameter types, resulting in cases where closure arguments weren't
being treated as `async` when they should have been.

rdar://149328745
2025-04-18 11:58:14 +01:00
Hamish Knight
15c7467f37 NFC: Abstract away the use of '7' to represent the next language mode
Introduce `Version::getFutureMajorLanguageVersion` to make it easier
to find clients that will need to be updated once we have a new
language mode.
2025-04-18 11:58:14 +01:00
Pavel Yaskevich
0af7032d91 [AST] Mark parameter declarations as caller isolated
When `nonisolated(nonsending)` parameter specifier is present
mark the declaration as caller isolated.

(cherry picked from commit 9bc96d4669)
2025-04-17 11:44:11 -07:00
Doug Gregor
cead04b530 [Conformance cache] Add allocated extended-storage for entries to the free list
This memory is part of the conformance cache concurrent hash map, so
when we clear the conformance cache, record each of the allocated
pointers within the concurrent map's free list. This way, it'll be
freed with the rest of the concurrent map when it's safe to do so.

(cherry picked from commit 885f829a63)
2025-04-17 09:03:16 -07:00
eeckstein
16804e6050 Merge pull request #80849 from eeckstein/copy-block-optimization-6.2
[6.2] Optimizer: remove redundant copy_block instructions
2025-04-17 14:22:56 +02:00
Pavel Yaskevich
65f78f3c01 Merge pull request #80807 from xedin/se-0461-renamings-6.2
[6.2][SE-0461] Replace `@execution(...)` with `@concurrent` and `nonisolated(nonsending)`
2025-04-16 20:47:14 -07:00
Konrad `ktoso` Malawski
361ebea8d7 Merge pull request #80797 from ktoso/pick-wip-parent-cancel-must-cancel-group
[6.2][Concurrency] Parent task cancellation must cancel task group itself
2025-04-17 11:33:11 +09:00
nate-chandler
184d25e76e Merge pull request #80856 from nate-chandler/cherrypick/release/6.2/rdar148783895
6.2: [CoroutineAccessors] Only reference when available
2025-04-16 19:08:15 -07:00
Michael Gottesman
d1470fe55b Merge pull request #80840 from gottesmm/release/6.2-149019222
[6.2][rbi] Teach RBI how to handle non-Sendable bases of Sendable values
2025-04-16 14:24:55 -07:00
Pavel Yaskevich
e98ba2d0bc [Frontend] Add a feature to guard use of @concurrent and nonisolated(nonsending) in swift interface files 2025-04-16 13:20:16 -07:00
Pavel Yaskevich
826176a28a [AST] NFC: Add a convenient way to create implicit NonisolatedAttrs 2025-04-16 13:20:16 -07:00
Pavel Yaskevich
3896f8fd77 [AST] Remove ExecutionAttribute experimental feature
SE-0461 has been accepted and `@concurrent` and `nonisolated(nonsending)`
can be make generally available now.
2025-04-16 13:20:12 -07:00
Pavel Yaskevich
06f880e65c [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-16 13:18:52 -07:00
Steven Wu
dc045d3e66 Merge pull request #80688 from cachemeifyoucan/eng/PR-148538787-swift-6.2
[6.2][BridgingHeaderChaining] Bind bridging header module when load module
2025-04-16 12:21:46 -07:00
Nate Chandler
de1d5ae894 [CoroutineAccessors] Only reference when available
Don't bind references to storage to use (new ABI) coroutine accessors
unless they're guaranteed to be available.  For example, when building
against a resilient module that has coroutine accessors, they can only
be used if the deployment target is >= the version of Swift that
includes the feature.

rdar://148783895
2025-04-16 11:05:02 -07:00
Nate Chandler
85860f6960 [NFC] AST: Extract helper method.
Several callers of `AbstractStorageDecl::getAccessStrategy` only cared
about whether the the access would be via physical storage.  Before
adding more arguments to `getAccessStrategy` for which such callers
would have to pass a sentinel value, add a convenience method for this.
2025-04-16 11:05:01 -07:00
Pavel Yaskevich
fde841704c [AST/Parse] Implement nonisolated(nonsending) type modifier 2025-04-16 10:06:08 -07:00