Skip to content

Commit 3d456ed

Browse files
committed
[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
1 parent 7592842 commit 3d456ed

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

include/swift/Basic/Features.def

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@
6969
# endif
7070
#endif
7171

72+
// A feature that's both suppressible and upcoming.
73+
// Delegates to whichever the includer defines.
74+
#ifndef SUPPRESSIBLE_UPCOMING_FEATURE
75+
# if defined(SUPPRESSIBLE_UPCOMING_FEATURE) && \
76+
defined(UPCOMING_FEATURE)
77+
# error ambiguous defines when including Features.def
78+
# elif defined(SUPPRESSIBLE_LANGUAGE_FEATURE)
79+
# define SUPPRESSIBLE_UPCOMING_FEATURE(FeatureName, SENumber, Version) \
80+
SUPPRESSIBLE_LANGUAGE_FEATURE(FeatureName, SENumber, #FeatureName)
81+
# else
82+
# define SUPPRESSIBLE_UPCOMING_FEATURE(FeatureName, SENumber, Version) \
83+
UPCOMING_FEATURE(FeatureName, SENumber, Version)
84+
# endif
85+
#endif
86+
7287
#ifndef SUPPRESSIBLE_LANGUAGE_FEATURE
7388
# define SUPPRESSIBLE_LANGUAGE_FEATURE(FeatureName, SENumber, Description) \
7489
LANGUAGE_FEATURE(FeatureName, SENumber, Description)
@@ -198,6 +213,8 @@ UPCOMING_FEATURE(DynamicActorIsolation, 423, 6)
198213
UPCOMING_FEATURE(NonfrozenEnumExhaustivity, 192, 6)
199214
UPCOMING_FEATURE(GlobalActorIsolatedTypesUsability, 0434, 6)
200215
UPCOMING_FEATURE(BorrowingSwitch, 432, 6)
216+
UPCOMING_FEATURE(TransferringArgsAndResults, 430, 6)
217+
SUPPRESSIBLE_UPCOMING_FEATURE(SendingArgsAndResults, 430, 6)
201218

202219
// Swift 7
203220
UPCOMING_FEATURE(ExistentialAny, 335, 7)
@@ -352,16 +369,6 @@ EXPERIMENTAL_FEATURE(FixedArrays, true)
352369
// Group Main Actor Isolation Errors by Scope
353370
EXPERIMENTAL_FEATURE(GroupActorErrors, true)
354371

355-
// Allow for the 'transferring' keyword to be applied to arguments and results.
356-
//
357-
// Enables SendingArgsAndResults as well. After parsing, we just represent this
358-
// as 'sendable' implying that since both are always enabled together, this
359-
// doesn't need to be suppressed.
360-
EXPERIMENTAL_FEATURE(TransferringArgsAndResults, true)
361-
362-
// Allow for the 'sending' keyword to be applied to arguments and results.
363-
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(SendingArgsAndResults, true)
364-
365372
// Enable explicit isolation of closures.
366373
EXPERIMENTAL_FEATURE(ClosureIsolation, true)
367374

lib/DriverTool/sil_opt_main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,12 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
794794
Invocation.getLangOptions().enableFeature(Feature::RegionBasedIsolation);
795795
}
796796

797+
if (Invocation.getLangOptions().hasFeature(Feature::RegionBasedIsolation)) {
798+
Invocation.getLangOptions().enableFeature(
799+
Feature::TransferringArgsAndResults);
800+
Invocation.getLangOptions().enableFeature(Feature::SendingArgsAndResults);
801+
}
802+
797803
if (Invocation.getLangOptions().hasFeature(
798804
Feature::TransferringArgsAndResults)) {
799805
Invocation.getLangOptions().enableFeature(Feature::SendingArgsAndResults);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,13 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
10641064
Opts.enableFeature(Feature::RegionBasedIsolation);
10651065
}
10661066

1067+
// Enable TransferringArgsAndResults/SendingArgsAndResults whenever
1068+
// RegionIsolation is enabled.
1069+
if (Opts.hasFeature(Feature::RegionBasedIsolation)) {
1070+
Opts.enableFeature(Feature::TransferringArgsAndResults);
1071+
Opts.enableFeature(Feature::SendingArgsAndResults);
1072+
}
1073+
10671074
// Enable SendingArgsAndResults whenever TransferringArgsAndResults is
10681075
// enabled.
10691076
//

0 commit comments

Comments
 (0)