Commit Graph

236 Commits

Author SHA1 Message Date
Pavel Yaskevich
3a0acf8043 [AST/Sema] Decouple @preconcurrency conformances from DynamicActorIsolation feature flag 2024-04-14 21:28:13 -07:00
Nate Chandler
943cc3cc7c [NoncopyablePartialConsumption] Enable.
SE-429 was accepted.

rdar://126275392
2024-04-11 08:19:29 -07:00
Erik Eckstein
a980452e59 Add the experimental attribute @sensitive for struct declarations
The attribute declares that a struct contains "sensitive" data.
It enforces that the contents of such a struct value is zeroed out at the end of its lifetime.
In other words: the content of such a value is not observable in memory after the value's lifetime.

Also add an experimental feature `Sensitive` with which the attribute can be enabled.
2024-04-09 12:01:10 +02:00
Kuba Mracek
7d44c2be48 [Volatile] Add a -enable-experimental-feature Volatile 2024-04-05 15:13:30 -07:00
Doug Gregor
61b19c8fbf Merge branch 'main' into import-extension-visibility 2024-04-03 21:43:21 -07:00
Kavon Farvardin
30983530b6 NCGenerics: introduce SuppressedAssociatedTypes
The model for associated types hasn't been fully worked-out for
noncopyable generics, but there is some support already that is being
used by the stdlib for an internal-only (and rather cursed) protocol
`_Pointer` to support `UnsafePointer`, etc.

This patch gates the existing experimental support for associated types
behind a feature flag. This flag doesn't emit feature-guards in
interfaces, since support for it is tied closely to NoncopyableGenerics
and has been there from its early days.
2024-04-02 16:53:36 -07:00
Alejandro Alonso
36bf2ae3bf Merge pull request #72592 from Azoy/raw-layout-inst
[IRGen] Add Builtin.addressOfRawLayout
2024-03-29 07:38:37 -07:00
Becca Royal-Gordon
576a4bac36 Merge pull request #72596 from beccadax/objcimpl-real-name
Add @implementation and feature flags for objcImpl
2024-03-28 23:48:24 -07:00
Allan Shortlidge
590d3353e6 Frontend: Introduce an alias for the IsolatedAny experimental feature.
To preserve compatibility with older compilers that do not allow `IsolatedAny`
to be enabled in production compilers, use an alias experimental feature when
building the stdlib (`IsolatedAny2`).

Also, add `@_allowFeatureSuppression(IsolatedAny)` in a couple spots it was
forgotten.

Partially resolves rdar://125138945
2024-03-27 22:20:50 -07:00
Allan Shortlidge
ee73ff7737 AST: Adjust declaration printing when NoncopyableGenerics2 is suppressed.
When printing declarations with `NoncopyableGenerics2` suppressed we must avoid
printing the `@_preInverseGenerics` attribute and any `borrowing` or
`consuming` parameter ownership modifiers.
2024-03-27 22:20:49 -07:00
Allan Shortlidge
2813fbe309 Frontend: Introduce an alias for the NoncopyableGenerics experimental feature.
The `.swiftinterface` of the standard library must remain compatible with some
older compilers. Unfortunately, some of those older compilers do not allow the
experimental feature `NoncopyableGenerics` to be enabled in production. To
allow the stdlib to build with non-copyable generics enabled and still have the
older compilers consume its interface, we have to use a new experimental
feature identifier that they do not know about.

Partially resolves rdar://125138945
2024-03-27 22:20:25 -07:00
Becca Royal-Gordon
492d4ad49d Add experimental feature flags for @implementation
• ObjCImplementation controls @implementation on extensions
• CImplementation controls @implementation and @_objcImplementation on cdecl functions

Why the difference between them? Because `@_objcImplementation extension` has already been adopted pretty widely, while `@_objcImplementation @_cdecl` is very new.
2024-03-27 14:29:57 -07:00
Alejandro Alonso
5d0deaa4a3 Add Builtin.addressOfRawLayout 2024-03-27 09:47:01 -07:00
Allan Shortlidge
b249503a2b AST: Introduce @_disallowFeatureSuppression attribute.
This attribute is the inverse of the existing `@_allowFeatureSuppression`
attribute.

Part of rdar://125138945
2024-03-26 17:27:57 -07:00
Sima Nerush
f1bb9c845e Merge pull request #72473 from simanerush/nonisolated-property-struct-inference
[Concurrency] Infer `nonisolated` for a mutable storage of a value type accessed from within the module.
2024-03-25 09:36:36 -07:00
Sima Nerush
05859b442c [Features] Gate global-actor-isolated types usability changes behind an experimental feature flag. 2024-03-23 20:03:01 -07:00
Kavon Farvardin
76c6510519 Merge pull request #72276 from kavon/ncgenerics-xfails-3 2024-03-16 04:18:35 -07:00
Ellie Shin
8a4137ac6c Merge pull request #72342 from apple/elsh/add-features
Map package optimization flags to features
2024-03-15 20:20:39 -07:00
Doug Gregor
164ae687ff Make NoncopyableGenerics a suppressible feature
Emit Swift interface files that are compatible with Swift compilers that
predate the introduction of noncopyable generics.
2024-03-15 14:50:40 -07:00
Ellie Shin
951e2abdea Create features mapped to package optimization flags to
allow a more standard way to pass experimental features
from build systems. Also moved other flags relevant to
diagnostics from Frontend options to Lang options.

Ref: rdar://124648653
2024-03-15 14:18:33 -07:00
Kavon Farvardin
2d065bb03b Features: Sendable doesn't use NoncopyableGenerics 2024-03-14 23:10:44 -07:00
Sophia Poirier
95abb73e1a Merge pull request #72175 from sophiapoirier/explicitly-nonisolated-closure
[Concurrency] explicit nonisolated specification for closures
2024-03-14 17:17:00 -07:00
Sophia Poirier
5ce7be7e75 [Concurrency] explicit nonisolated specification for closures 2024-03-14 12:24:13 -07: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
John McCall
8499640224 Merge pull request #72143 from rjmccall/builtin-create-task
Unify and simplify the task-creation builtins
2024-03-07 21:45:06 -05:00
John McCall
02ddc292da Add Builtin.createTask and Builtin.createDiscardingTask. 2024-03-06 23:50:46 -05:00
Slava Pestov
b067402238 AST: Remove a usage of hasInverseMarking() 2024-03-06 22:47:54 -05:00
Slava Pestov
dcea491dbe Sema: Remove inference of conditional Copyable conformance from generic parameters 2024-03-06 22:47:54 -05:00
Doug Gregor
cff918428a Implement proper visibility rules for imported extensions
If an extension isn't imported either directly or via a transitive
(`@_exported`) import, its members should not be visible to name
lookup. Implement this behavior behind the experimental flag
ExtensionImportVisibility.
2024-03-04 07:43:54 -08:00
Allan Shortlidge
ba9b3023e0 AST: Make $UnavailableFromAsync and $NoAsyncAvailability baseline features.
They have been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
d5e3e9418d AST: Make $UnsafeInheritExecutor a baseline feature.
It has been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
969efc8413 AST: Add several language features to the baseline feature set.
This allows us to remove their explicit `UNINTERESTING_FEATURE` entries for
them FeatureSet.cpp. All of these features have been present in the compiler
since at least Swift 5.8.

NFC.
2024-03-02 23:15:41 -08:00
John McCall
1437acdf22 Implement conditional feature suppression.
Our standard conception of suppressible features assumes we should
always suppress the feature if the compiler doesn't support it.
This presumes that there's no harm in suppressing the feature, and
that's a fine assumption for features that are just adding information
or suppressing new diagnostics.  Features that are semantically
relevant, maybe even ABI-breaking, are not a good fit for this,
and so instead of reprinting the decl with the feature suppressed,
we just have to hide the decl entirely.  The missing middle here
is that it's sometimes useful to be able to adopt a type change
to an existing declaration, and we'd like older compilers to be
able to use the older version of the declaration.  Making a type
change this way is, of course, only really acceptable for
@_alwaysEmitIntoClient declarations; but those represent quite a
few declarations that we'd like to be able to refine the types of.

Rather than trying to come up with heuristics based on
@_alwaysEmitIntoClient or other sources of information, this design
just requires the declaration to opt in with a new attribute,
@_allowFeatureSuppress.  When a declaration opts in to suppression
for a conditionally-suppressible feature, the printer uses the
suppression serially-print-with-downgraded-options approach;
otherwise it uses the print-only-if-feature-is-available approach.
2024-03-01 22:10:14 -05:00
Doug Gregor
6075de1b62 Add upcoming feature ImplicitOpenExistentials for SE-0352
To maintain source compatibility, SE-0352 does not open existentials
with "self-conforming" type, such as `any Error` or existentials based
on `@objc` protocols. The proposal specified that this behavior would
change in Swift 6. Implement that behavior change, which can be
enabled prior to Swift 6 with the upcoming feature
`ImplicitOpenExistentials` (as documented in SE-0362).

Fixes #70873 / rdar://120902975.
2024-03-01 11:50:39 -08:00
Allan Shortlidge
44e44889a4 AST: Simplify usesFeatureTypedThrows().
NFC.
2024-03-01 00:16:41 -08:00
Allan Shortlidge
65e8ce5425 AST: Refactor FeatureSet out into its own file.
NFC.
2024-03-01 00:16:41 -08:00