Commit Graph

464 Commits

Author SHA1 Message Date
Holly Borla
32aba12db3 [Features] FullTypedThrows should only be enable-able in asserts builds.
The implementation of this experimental feature is not complete and it's
not ready to be enabled in production.
2024-06-14 21:21:27 -07:00
Joe Groff
f819bed190 Make BorrowingSwitch a LANGUAGE_FEATURE.
It doesn't guard any source breaks, so it doesn't need to be an UPCOMING_FEATURE.
rdar://129417451
2024-06-07 14:26:23 -07:00
Joe Groff
efc193ffa3 Merge pull request #74154 from jckarter/treat-reinit-attempts-in-multi-block-defers-as-errors
Turn mishandled reinitialize-in-`defer`-after-`consume` cases into errors.
2024-06-05 21:04:34 -07:00
Joe Groff
74aaf88697 Turn mishandled reinitialize-in-defer-after-consume cases into errors.
The handling of multi-basic-block control flow in `defer` blocks looks like it
was left incomplete and completely untested; I fixed a few obvious problems but
it still completely lacks any analysis of conditional reinitializations. For now,
change it to treat attempted reinitializations as uses-after-consumes so we raise
reliable errors now instead of emitting code that causes memory corruption at
runtime. Fixes rdar://129303198.
2024-06-05 14:12:00 -07:00
Michael Gottesman
88729b9e34 [sending] Make {Transferring,Sending}ArgsAndResults a LANGUAGE_FEATURE instead of an UPCOMING_FEATURE.
TLDR: This makes it so that we always can parse sending/transferring but changes
the semantic language effects to be keyed on RegionBasedIsolation instead.

----

The key thing that makes this all work is that I changed all of the "special"
semantic changes originally triggered on *ArgsAndResults to now be triggered
based on RegionBasedIsolation being enabled. This makes a lot of sense since we
want these semantic changes specifically to be combined with the checkers that
RegionBasedIsolation turns on. As a result, even though this causes these two
features to always be enabled, we just parse it but we do not use it for
anything semantically.

rdar://128961672
2024-06-01 23:25:16 -07:00
Nate Chandler
60cdbb84a5 [Features] Move NoncopyableGenerics up.
Some compilers have the NoncopyableGenerics feature enabled via
interesting mechanisms but do not have ConformanceSuppression.  To
support such compilers, the NoncopyableGenerics feature must appear
before ConformanceSuppression in the list of features.  Otherwise, when
parsing the portion of the swiftinterface corresponding to an entity
which involves both features, the first check will be for
NoncopyableGenerics (which that old compiler has) and the code inside
will involve ConformanceSuppression (which that old compiler does not
have).

rdar://128611158
2024-05-23 10:12:01 -07:00
Doug Gregor
2388acdfd3 [SE-0415] Enable function body macros by default
Preamble macros are *not* part of the revised SE-0415, so leave them
experimental.

Tracked by rdar://119687390.
2024-05-20 22:08:33 -07:00
Michael Gottesman
20a3589763 [sending] Enable sending whenever region isolation is enabled and make SE-0430 an upcoming feature.
I also added support for expressing suppressable upcoming features.

rdar://128216574
2024-05-17 19:56:29 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
A few things:

1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.

2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.

3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.

4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.

rdar://128216574
2024-05-16 21:43:50 -07:00
Joe Groff
10f9289ef8 Enable 'BorrowingSwitch' feature. 2024-05-14 07:31:59 -07:00
Michael Gottesman
de85b79423 [concurrency] Make GlobalActorIsolatedTypesUsability an upcoming swift 6 feature.
rdar://118244451
2024-05-13 18:40:58 -07:00
Nate Chandler
2671652085 [BitwiseCopyable] Avoid a condfail.
The standard library defines
```
protocol BitwiseCopyable {}
typealias _BitwiseCopyable = BitwiseCopyable
```
For current compilers, `BitwiseCopyable` is a "known protocol".

For older compilers, it is not; instead `_BitwiseCopyable` is.  So
print the following into the swiftinterface for those older compilers:
```
protocol _BitwiseCopyable {}
typealias BitwiseCopyable = _BitwiseCopyable
```

rdar://127755503
2024-05-08 16:53:14 -07:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Holly Borla
e7db0ec8f8 Merge pull request #73472 from hborla/exhaustive-switch-error
[Sema] Non-exhaustive switch statements are always an error in Swift 6.
2024-05-07 09:03:40 -07:00
Holly Borla
a7920ce50b [Features] Replace -enable-nonfrozen-enum-exhaustivity-diagnostics with an
upcoming feature.

The bespoke flag still works as a way to enable the `NonfrozenEnumExhaustivity`
upcoming feature. `NonfrozenEnumExhaustivity` is enabled by default in the
Swift 6 language mode as errors, and enabled by default in the Swift 5 language
mode as warnings.
2024-05-06 20:56:20 -07:00
Nate Chandler
c10d39e35f [AST] Remove Builtin.copy.
A vestigial remnant of it was left behind after
06921cfe84 in order to avoid a reverse
condfail when building old swiftinterfaces that define

```swift
func _copy<T>(_ value: T) -> T {
  #if $BuiltinCopy
    Builtin.copy(value)
  #else
    value
  #endif
}
```

If the language feature is removed, though, such interfaces should again
be buildable because the branch where the language feature isn't defined
should be expanded.

rdar://127516085
2024-05-04 11:35:17 -07:00
nate-chandler
bcd08c0c9a Merge pull request #73235 from nate-chandler/bitwise-copyable/enable
[BitwiseCopyable] Promote to feature.
2024-05-04 10:16:40 -07:00
Becca Royal-Gordon
981233ad37 Merge pull request #73128 from beccadax/objcimpl-resilient
Handle resilient stored properties in objcImpl
2024-04-30 20:50:33 -07:00
Michael Gottesman
dc25857805 [transferring] Make transferring suppressible and validate that we do suppress transferring in swift interface files.
Importantly I added tests that validated this behavior.

rdar://126780823
2024-04-30 16:40:40 -07:00
Becca Royal-Gordon
f94ed6d606 Hide objcImpl resilience support behind feature
Resilence support will require changes to the Objective-C runtime to expand support for metadata initialization functions. Add a separate experimental feature flag to help with staging that support in, and modify diagnostics to not suggest increasing the minimum deployment target for now.
2024-04-30 12:03:46 -07:00
Nate Chandler
6e975da805 [BitwiseCopyable] Promote ConformanceSuppression.
The ability to suppress conformance to BitwiseCopyable was part of the
accepted SE-428.
2024-04-24 15:52:20 -07:00
Nate Chandler
ed5c7ef7ae [BitwiseCopyable] Promote to feature.
SE-0426 was accepted.
2024-04-24 15:52:20 -07:00
nate-chandler
1faeb50fff Merge pull request #73121 from nate-chandler/rdar126715654
[NoncopyablePartialConsumption] Promote to feature.
2024-04-22 07:01:10 -07:00
Holly Borla
a08c24044e Merge pull request #73168 from hborla/isolated-backing-property-wrapper
[Concurrency] Don't error on isolated property wrapper initializers inside `MainActor`-isolated structs.
2024-04-21 19:44:31 -07:00
Holly Borla
a6d9c15fb3 [Concurrency] Don't error on isolated property wrapper initializers inside
MainActor-isolated structs.
2024-04-21 10:01:31 -07:00
Alexis Laferrière
bed91dc740 Merge pull request #73141 from xymus/no-internal-imports-by-default
Sema: Remove internal imports by default from Swift 6
2024-04-19 15:26:25 -07:00
Nate Chandler
de8f1c0b69 [NoncopyablePartialConsumption] Promote to feature 2024-04-19 12:37:34 -07:00
Alexis Laferrière
a890d8fded Sema: Remove internal imports by default from Swift 6
The language steering group has decided to revert their previous
decision and remove this feature from Swift 6.

rdar://126318567
2024-04-19 12:19:29 -07:00
Dave Lee
e57f70bd4d [Debugging] Add DebugDescriptionMacro experimental feature (#73107)
This removes the leading underscore from the macro.
2024-04-18 17:25:44 -07:00
nate-chandler
b00b5aad4f Merge pull request #72646 from nate-chandler/bitwise-copyable/20240327/1
[BitwiseCopyable] Allow suppression via ~.
2024-04-18 07:05:10 -07:00
Allan Shortlidge
d43816567f AST: Rename ExtensionImportVisibility to MemberImportVisibility.
This feature controls lookup behavior for members in general, not just
extension members.

Resolves rdar://126491324
2024-04-16 16:29:51 -07:00
Nate Chandler
ba467d2bd2 [Sema] Enable suppression of inferred conformances.
Add the machinery to support suppression of inference of conformance to
protocols that would otherwise be derived automatically.

This commit does not enable any conformances to be suppressed.
2024-04-15 16:46:22 -07:00
Pavel Yaskevich
03e9d4258e [Frontend] NFC: Promote DynamicActorIsolation to an upcoming 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
Allan Shortlidge
78cd1149bd stdlib: Adopt ExtensionImportVisibility experimental feature.
This didn't expose any missing imports in the sources of any of the standard
library modules, but that's not entirely surprising. Still, we should have the
feature enabled to test it and prevent regressions from creeping in before the
behavior becomes the default.

Exclude `ExtensionImportVisibility` from module interfaces.
2024-04-05 09:22:02 -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
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
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