Commit Graph

46165 Commits

Author SHA1 Message Date
Pavel Yaskevich
eb7b76525c Merge pull request #79651 from xedin/sendability-checks-for-function-conversions
[Concurrency] Implement sendability checking for `@Sendable` function…
2025-03-04 09:33:59 -08:00
Gábor Horváth
3b412ae0c6 Merge pull request #79697 from swiftlang/gaborh/do-not-import-nonesc-pointees
[cxx-importer] Do not import pointers to non-escapable types
2025-03-04 17:26:38 +00:00
Doug Gregor
c169f8850b Merge pull request #79760 from DougGregor/isolated-conformances-checking
Ensure that isolated conformances originate in the same isolation domain
2025-03-04 07:49:53 -08:00
Artem Chikin
13a8d4b88e [Compile Time Values] Add a new experimental feature and the parsing of the '@const' attribute 2025-03-04 07:30:57 -08:00
Artem Chikin
de26e960e2 Rename '_const' attribute to 'CompileTimeLiteral'
To pave the way for the new experimental feature which will operate on '@const' attribute and expand the scope of what's currently handled by '_const' without breaking compatibility, for now.
2025-03-04 07:30:02 -08:00
Holly Borla
f0446d0271 Merge pull request #79729 from hborla/concurrency-sugar
[Concurrency] Add an experimental macro for wrapping a function body in a new task.
2025-03-04 06:14:15 -08:00
Anthony Latsis
0b542fc5e8 Basic: Define ExistentialAny as supporting adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2771f36ced LangOptions: Refactor feature state and API to account for adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2a88419f5c Frontend: Do not suggest mode correction if adoption is not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
756abb9284 Frontend: Warn if adoption mode is requested but not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
8dab67bcee Basic: Adjust feature macros for adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2abf67872c Frontend: Parse a feature mode specifier 2025-03-04 13:43:28 +00:00
Gabor Horvath
d0c167762c [cxx-importer] Do not import pointers to non-escapable types
Unfortunately, Unsafe*Pointer types do not support non-escapable
pointees so we do not really have anything to map these types to at the
moment. Previously, importing such code resulted in crashes.

rdar://145800679
2025-03-04 12:27:34 +00:00
Andrew Trick
5783b497e5 Merge pull request #79758 from atrick/addressable-deps
Support enforcement of '@'_addressable under -enable-address-dependencies
2025-03-03 23:51:56 -08:00
Allan Shortlidge
a7de6ec0a3 Merge pull request #79761 from tshortli/availability-context-trailing-objects
AST: Reimplement `AvailabilityContext` storage using `TrailingObjects`
2025-03-03 23:40:31 -08:00
Doug Gregor
6f6b8dd071 [Diagnostics] Provide category name + documentation path
Bridge the category name and educational note computed for the Swift
compiler's diagnostics to the newly-introduced category field for
the swift-syntax diagnostics. This lets the swift-syntax renderer
introduce the category name and (optionally) link to the
documentation.
2025-03-03 22:49:33 -08:00
John Hui
98f4c1d263 [NFC] inline hasDomain into assertion (#79755) 2025-03-03 22:12:08 -08:00
Holly Borla
fdd7402bbf [Educational Notes] Add an explanation for sending closure arguments. 2025-03-03 21:44:30 -08:00
Holly Borla
0f7c991eec [Educational Notes] Add an explanation for actor-isolated calls from
synchronous nonisolated contexts.
2025-03-03 21:44:30 -08:00
Holly Borla
cf437719fa [Educational Notes] Add an explanation for captures in a @Sendable
closure.
2025-03-03 21:40:59 -08:00
Holly Borla
4353c5a2fe [Educational Notes] Add an explanation for the unsafe global variable
errors.
2025-03-03 21:22:33 -08:00
Holly Borla
72eab9f02a [Educational Notes] Add an explanation for `sending 'x' risks causing
data races`.
2025-03-03 21:22:33 -08:00
Holly Borla
8be41edf6f [Concurrency] Add a macro for wrapping a function body in a new task. 2025-03-03 20:51:14 -08:00
Allan Shortlidge
c6a5e6f745 AST: Reimplement AvailabilityContext storage using TrailingObjects.
This makes more efficient use of the permanent memory allocated for
`AvailabilityContext` representations and also fixes a leak that was introduced
in https://github.com/swiftlang/swift/pull/79718 where the small vector for
unavailable domain storage was not being cleaned up on `ASTContext`
deallocation.

Resolves rdar://145929932.
2025-03-03 18:29:34 -08:00
Doug Gregor
064e0c6264 Ensure that isolated conformances originate in the same isolation domain
This is the missing check for "rule #1" in the isolated conformances proposal,
which states that an isolated conformance can only be referenced within
the same isolation domain as the conformance. For example, a
main-actor-isolated conformance can only be used within main-actor code.
2025-03-03 17:47:50 -08:00
Andrew Trick
fa64a362a2 Add -Xfrontend -enable-address-dependencies
Temporary option to bootstrap '@'_addressable enforcement.

Once all the SILGen cases are handled, we won't need this option.
2025-03-03 16:21:48 -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
Konrad `ktoso` Malawski
92ead521b8 [Concurrency] Fix swift-inspect and remote mirror build (#79715) 2025-03-04 07:04:42 +09:00
Andrew Trick
bc6200e592 SwiftCompilerSources: bridge '@'_addressable dependencies 2025-03-03 11:56:37 -08:00
Andrew Trick
c937aa079e Merge pull request #79736 from atrick/fix-address-walk
Add verification to catch many incorrect liveness checks
2025-03-03 11:54:40 -08:00
Alexis Laferrière
eb148b1d37 Merge pull request #79713 from xymus/index-while-building-allow-errors
Index: Accept more deserialization inconsistencies during index-while-building
2025-03-03 11:33:31 -08:00
Adrian Prantl
a1724891ec Merge pull request #79700 from adrian-prantl/getinstancetypeinfo
[reflection] Generalize the implementation of getInstanceTypeInfo()
2025-03-03 09:02:44 -08:00
Andrew Trick
d73a081fe7 Add pointer escape and dependent use tracking to InteriorLiveness
Rig TransitiveAddressWalker to keep track of enough information for passes to
correctly check for pointer escapes and dependence uses. Requires for precise
bail-outs and asserts.
2025-03-02 23:51:34 -08:00
Allan Shortlidge
dc2fe53089 AST: Rename a couple of AvailabilityConstraint::Reason cases.
Choose names that don't imply availability is versioned, since custom
availability will support domains that are version-less (they are simply
available or unavailable).
2025-03-02 15:08:37 -08:00
Allan Shortlidge
b630fe5479 AST: Rename Range to PlatformRange in AvailabilityContext::Info. 2025-03-02 14:45:50 -08:00
Allan Shortlidge
866db542a3 Gardening: Use const consistently for ASTContext parameters. 2025-03-02 14:45:50 -08:00
Allan Shortlidge
dc3df46dd5 Merge pull request #79730 from tshortli/availability-comparisons
AST: Consolidate availability version remapping
2025-03-02 14:41:57 -08:00
Andrew Trick
6975663581 Merge pull request #79731 from atrick/fix-markdep-walk
Fix TransitiveAddressWalker with mark_dependence
2025-03-02 08:51:31 -08:00
Andrew Trick
45cac09728 Fix TransitiveAddressWalker with mark_dependence
This utility was simply ignoring the dependent value. But the
dependent value logically uses the base address. Until this is
correctly implemented, conservatively consider it a pointer-escape.
2025-03-01 22:25:42 -08:00
Allan Shortlidge
3b9ca2f397 AST: Consolidate availability version remapping.
Introduce `SemanticAvailableAttr` conveniences to compute the deprecated and
obsoleted ranges for an attribute and ensure they remap versions when needed.
2025-03-01 20:23:11 -08:00
Doug Gregor
ee2450f212 Merge pull request #79724 from DougGregor/isolated-conformances-constraint-system
Prohibit isolated conformances with Sendable(Metatype) constraints
2025-03-01 13:16:32 -08:00
Allan Shortlidge
a0010cbf05 Merge pull request #79718 from tshortli/multiple-unavailable-domains
AST: Allow multiple unavailable domains in `AvailabilityContext`
2025-03-01 09:24:11 -08:00
Doug Gregor
6a4d1a41c4 Prohibit isolated conformances with Sendable(Metatype) constraints
Within the constraint system, introduce a new kind of conformance constraint,
a "nonisolated conforms-to" constraint, which can only be satisfied by
nonisolated conformances. Introduce this constraint instead of the normal
conforms-to constraint whenever the subject type is a type parameter that
has either a `Sendable` or `SendableMetatype` constraint, i.e., when the type
or its values can escape the current isolation domain.
2025-03-01 08:19:42 -08:00
Kuba Mracek
71a5e397e4 [embedded][Concurrency] Fix missing swift_deletedAsyncMethodError 2025-03-01 06:48:39 -08:00
Allan Shortlidge
fc41265d4d Merge pull request #79711 from tshortli/availability-diagnostics
AST/Sema: Adopt `AvailabilityDomain` arguments in diagnostics
2025-02-28 22:30:09 -08:00
Allan Shortlidge
f34e135cfa AST: Add verification for AvailabilityContext. 2025-02-28 19:09:34 -08:00
Allan Shortlidge
9455a0fece AST: Track multiple unavailable domains in AvailabilityContext. 2025-02-28 19:09:34 -08:00
Allan Shortlidge
b02d44352e AST: Introduce StableAvailabilityDomainComparator. 2025-02-28 19:09:33 -08:00
Alexis Laferrière
302d6f1dcf Index: Accept compiler errors during index-while-building
Force allowing reading from modules with compiler errors during
index-while-building as a way to recover from more deserialization
issues.
2025-02-28 14:56:26 -08:00
Allan Shortlidge
309db1c220 Sema: Update feature availability diagnostics to take AvailabilityDomain. 2025-02-28 14:46:34 -08:00