[AST] Remove ExecutionAttribute experimental feature

SE-0461 has been accepted and `@concurrent` and `nonisolated(nonsending)`
can be make generally available now.
This commit is contained in:
Pavel Yaskevich
2025-04-09 00:25:55 -07:00
parent 9da457d129
commit f1b3c7b604
21 changed files with 26 additions and 97 deletions

View File

@@ -884,7 +884,6 @@ SIMPLE_DECL_ATTR(concurrent, Concurrent,
OnFunc | OnConstructor | OnSubscript | OnVar,
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove | UnconstrainedInABIAttr,
170)
DECL_ATTR_FEATURE_REQUIREMENT(Concurrent, ExecutionAttribute)
LAST_DECL_ATTR(Concurrent)

View File

@@ -404,9 +404,6 @@ struct PrintOptions {
/// Suppress modify/read accessors.
bool SuppressCoroutineAccessors = false;
/// Suppress the @execution attribute
bool SuppressExecutionAttribute = false;
/// List of attribute kinds that should not be printed.
std::vector<AnyAttrKind> ExcludeAttrList = {
DeclAttrKind::Transparent, DeclAttrKind::Effects,

View File

@@ -484,10 +484,6 @@ SUPPRESSIBLE_EXPERIMENTAL_FEATURE(AddressableTypes, true)
/// Allow the @abi attribute.
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(ABIAttribute, true)
/// Allow the @execution attribute. This is also connected to
/// AsyncCallerExecution feature.
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(ExecutionAttribute, false)
/// Functions with nonisolated isolation inherit their isolation from the
/// calling context.
ADOPTABLE_EXPERIMENTAL_FEATURE(AsyncCallerExecution, false)

View File

@@ -3302,14 +3302,6 @@ suppressingFeatureAddressableTypes(PrintOptions &options,
action();
}
static void
suppressingFeatureExecutionAttribute(PrintOptions &options,
llvm::function_ref<void()> action) {
llvm::SaveAndRestore<bool> scope1(options.SuppressExecutionAttribute, true);
ExcludeAttrRAII scope2(options.ExcludeAttrList, DeclAttrKind::Concurrent);
action();
}
/// Suppress the printing of a particular feature.
static void suppressingFeature(PrintOptions &options, Feature feature,
llvm::function_ref<void()> action) {

View File

@@ -502,48 +502,6 @@ static bool usesFeatureBuiltinEmplaceTypedThrows(Decl *decl) {
return false;
}
static bool usesFeatureExecutionAttribute(Decl *decl) {
if (!DeclAttribute::canAttributeAppearOnDecl(DeclAttrKind::Concurrent,
decl)) {
return false;
}
if (decl->getAttrs().hasAttribute<ConcurrentAttr>())
return true;
auto hasConcurrentAttr = [](TypeRepr *R) {
if (!R)
return false;
return R->findIf([](TypeRepr *repr) {
if (auto *AT = dyn_cast<AttributedTypeRepr>(repr)) {
return llvm::any_of(AT->getAttrs(), [](TypeOrCustomAttr attr) {
if (auto *TA = attr.dyn_cast<TypeAttribute *>()) {
return isa<ConcurrentTypeAttr>(TA);
}
return false;
});
}
return false;
});
};
auto *VD = cast<ValueDecl>(decl);
// Check if any parameters that have `@execution` attribute.
if (auto *PL = VD->getParameterList()) {
for (auto *P : *PL) {
if (hasConcurrentAttr(P->getTypeRepr()))
return true;
}
}
if (hasConcurrentAttr(VD->getResultTypeRepr()))
return true;
return false;
}
// ----------------------------------------------------------------------------
// MARK: - FeatureSet
// ----------------------------------------------------------------------------

View File

@@ -2,7 +2,6 @@
// RUN: %target-swift-frontend-dump-parse \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExecutionAttribute \
// RUN: -enable-experimental-feature Extern \
// RUN: -enable-experimental-feature LifetimeDependence \
// RUN: -enable-experimental-feature RawLayout \
@@ -14,7 +13,6 @@
// RUN: %target-swift-frontend-dump-parse \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExecutionAttribute \
// RUN: -enable-experimental-feature Extern \
// RUN: -enable-experimental-feature LifetimeDependence \
// RUN: -enable-experimental-feature RawLayout \
@@ -29,7 +27,6 @@
// RUN: -module-abi-name ASTGen \
// RUN: -enable-experimental-feature ParserASTGen \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExecutionAttribute \
// RUN: -enable-experimental-feature Extern \
// RUN: -enable-experimental-feature LifetimeDependence \
// RUN: -enable-experimental-feature RawLayout \
@@ -42,7 +39,6 @@
// REQUIRES: swift_swift_parser
// REQUIRES: swift_feature_ParserASTGen
// REQUIRES: swift_feature_ABIAttribute
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_Extern
// REQUIRES: swift_feature_LifetimeDependence
// REQUIRES: swift_feature_RawLayout

View File

@@ -1,4 +1,4 @@
// RUN: %target-run-simple-swift( -swift-version 6 -g %import-libdispatch -import-objc-header %S/Inputs/RunOnMainActor.h -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution )
// RUN: %target-run-simple-swift( -swift-version 6 -g %import-libdispatch -import-objc-header %S/Inputs/RunOnMainActor.h -enable-experimental-feature AsyncCallerExecution )
// REQUIRES: executable_test
// REQUIRES: concurrency
@@ -6,7 +6,6 @@
// REQUIRES: libdispatch
// REQUIRES: asserts
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_AsyncCallerExecution
// UNSUPPORTED: freestanding

View File

@@ -1,7 +1,6 @@
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -swift-version 5 -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution:adoption
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution:adoption
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -swift-version 5 -enable-experimental-feature AsyncCallerExecution:adoption
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature AsyncCallerExecution:adoption
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_AsyncCallerExecution
struct G<T> {

View File

@@ -1,6 +1,5 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -enable-experimental-feature AsyncCallerExecution %s | %FileCheck %s
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_AsyncCallerExecution

View File

@@ -1,7 +1,6 @@
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
@globalActor
actor MyActor {

View File

@@ -1,12 +1,11 @@
// RUN: %target-swift-emit-silgen %s -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute -DSWIFT_FIVE | %FileCheck -check-prefix CHECK -check-prefix FIVE %s
// RUN: %target-swift-emit-silgen %s -swift-version 6 -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute | %FileCheck -check-prefix CHECK -check-prefix SIX %s
// RUN: %target-swift-emit-silgen %s -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -DSWIFT_FIVE | %FileCheck -check-prefix CHECK -check-prefix FIVE %s
// RUN: %target-swift-emit-silgen %s -swift-version 6 -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple | %FileCheck -check-prefix CHECK -check-prefix SIX %s
// We codegen slightly differently for swift 5 vs swift 6, so we need to check
// both.
// REQUIRES: asserts
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
////////////////////////
// MARK: Declarations //

View File

@@ -1,12 +1,11 @@
// RUN: %target-swift-emit-silgen %s -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute -DSWIFT_FIVE | %FileCheck -check-prefix CHECK -check-prefix FIVE %s
// RUN: %target-swift-emit-silgen %s -swift-version 6 -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute | %FileCheck -check-prefix CHECK -check-prefix SIX %s
// RUN: %target-swift-emit-silgen %s -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple -DSWIFT_FIVE | %FileCheck -check-prefix CHECK -check-prefix FIVE %s
// RUN: %target-swift-emit-silgen %s -swift-version 6 -module-name attr_execution_silgen -target %target-swift-5.1-abi-triple | %FileCheck -check-prefix CHECK -check-prefix SIX %s
// We codegen slightly differently for swift 5 vs swift 6, so we need to check
// both.
// REQUIRES: asserts
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
protocol P {
nonisolated(nonsending) func callerTest() async

View File

@@ -183,6 +183,7 @@ actor MyGenericGlobalActor<T> {
// ON_GLOBALVAR-DAG: Keyword/None: exclusivity[#Var Attribute#]; name=exclusivity
// ON_GLOBALVAR-DAG: Keyword/None: preconcurrency[#Var Attribute#]; name=preconcurrency
// ON_GLOBALVAR-DAG: Keyword/None: backDeployed[#Var Attribute#]; name=backDeployed
// ON_GLOBALVAR-DAG: Keyword/None: concurrent[#Var Attribute#]; name=concurrent
// ON_GLOBALVAR-NOT: Keyword
// ON_GLOBALVAR-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_GLOBALVAR-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -220,6 +221,7 @@ struct _S {
// ON_PROPERTY-DAG: Keyword/None: exclusivity[#Var Attribute#]; name=exclusivity
// ON_PROPERTY-DAG: Keyword/None: preconcurrency[#Var Attribute#]; name=preconcurrency
// ON_PROPERTY-DAG: Keyword/None: backDeployed[#Var Attribute#]; name=backDeployed
// ON_PROPERTY-DAG: Keyword/None: concurrent[#Var Attribute#]; name=concurrent
// ON_PROPERTY-NOT: Keyword
// ON_PROPERTY-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_PROPERTY-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -251,6 +253,7 @@ struct _S {
// ON_METHOD-DAG: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency
// ON_METHOD-DAG: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed
// ON_METHOD-DAG: Keyword/None: lifetime[#Func Attribute#]; name=lifetime
// ON_METHOD-DAG: Keyword/None: concurrent[#Func Attribute#]; name=concurrent
// ON_METHOD-NOT: Keyword
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -326,6 +329,7 @@ struct _S {
// ON_MEMBER_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions
// ON_MEMBER_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime
// ON_MEMBER_LAST-DAG: Keyword/None: extensible[#Declaration Attribute#]; name=extensible
// ON_MEMBER_LAST-DAG: Keyword/None: concurrent[#Declaration Attribute#]; name=concurrent
// ON_MEMBER_LAST-NOT: Keyword
// ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -399,6 +403,7 @@ func dummy2() {}
// KEYWORD_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions
// KEYWORD_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime
// KEYWORD_LAST-DAG: Keyword/None: extensible[#Declaration Attribute#]; name=extensible
// KEYWORD_LAST-DAG: Keyword/None: concurrent[#Declaration Attribute#]; name=concurrent
// KEYWORD_LAST-NOT: Keyword
// KEYWORD_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// KEYWORD_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyGenericPropertyWrapper[#Property Wrapper#]; name=MyGenericPropertyWrapper

View File

@@ -7,8 +7,7 @@
// RUN: %batch-code-completion -filecheck-additional-suffix _DISABLED
// RUN: %batch-code-completion -filecheck-additional-suffix _ENABLED \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExecutionAttribute
// RUN: -enable-experimental-feature ABIAttribute
// NOTE: Please do not include the ", N items" after "Begin completions". The
// item count creates needless merge conflicts given that an "End completions"

View File

@@ -1,7 +1,6 @@
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name attrs \
// RUN: -emit-private-module-interface-path %t.private.swiftinterface \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExecutionAttribute
// RUN: -enable-experimental-feature ABIAttribute
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name attrs
// RUN: %target-swift-typecheck-module-from-interface(%t.private.swiftinterface) -module-name attrs
@@ -10,7 +9,6 @@
// RUN: %FileCheck %s --check-prefixes CHECK,PRIVATE-CHECK --input-file %t.private.swiftinterface
// REQUIRES: swift_feature_ABIAttribute
// REQUIRES: swift_feature_ExecutionAttribute
// CHECK: @_transparent public func glass() -> Swift.Int { return 0 }{{$}}
@_transparent public func glass() -> Int { return 0 }

View File

@@ -1,9 +1,9 @@
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name execution_attr -enable-experimental-feature ExecutionAttribute
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name execution_attr
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name execution_attr
// RUN: %FileCheck %s --input-file %t.swiftinterface
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: concurrency
public struct Test {
// CHECK: nonisolated(nonsending) public init() async

View File

@@ -1,7 +1,6 @@
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature ExecutionAttribute
// RUN: %target-typecheck-verify-swift -disable-availability-checking
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
typealias F = @concurrent () async -> Void

View File

@@ -1,8 +1,7 @@
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute | %FileCheck -check-prefix CHECK -check-prefix DISABLED %s
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution | %FileCheck -check-prefix CHECK -check-prefix ENABLED %s
// RUN: %target-swift-emit-silgen %s | %FileCheck -check-prefix CHECK -check-prefix DISABLED %s
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature AsyncCallerExecution | %FileCheck -check-prefix CHECK -check-prefix ENABLED %s
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_AsyncCallerExecution
// Validate that both with and without the experimental flag we properly codegen

View File

@@ -1,13 +1,12 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution -emit-module-path %t/WithFeature.swiftmodule -module-name WithFeature %S/Inputs/caller_inheriting_isolation.swift -swift-version 6
// RUN: %target-swift-frontend -enable-experimental-feature ExecutionAttribute -emit-module-path %t/WithoutFeature.swiftmodule -module-name WithoutFeature %S/Inputs/caller_inheriting_isolation.swift -swift-version 6
// RUN: %target-swift-frontend -enable-experimental-feature AsyncCallerExecution -emit-module-path %t/WithFeature.swiftmodule -module-name WithFeature %S/Inputs/caller_inheriting_isolation.swift -swift-version 6
// RUN: %target-swift-frontend -emit-module-path %t/WithoutFeature.swiftmodule -module-name WithoutFeature %S/Inputs/caller_inheriting_isolation.swift -swift-version 6
// RUN: %target-swift-frontend -module-name main -I %t %s -emit-sil -o - | %FileCheck %s
// RUN: %target-swift-frontend -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution -module-name main -I %t %s -emit-sil -verify -swift-version 6
// RUN: %target-swift-frontend -enable-experimental-feature AsyncCallerExecution -module-name main -I %t %s -emit-sil -verify -swift-version 6
// REQUIRES: asserts
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_AsyncCallerExecution
import WithFeature

View File

@@ -1,9 +1,8 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature Extern -enable-experimental-feature ABIAttribute -enable-experimental-feature AddressableParameters -enable-experimental-feature NoImplicitCopy -enable-experimental-feature SymbolLinkageMarkers -enable-experimental-feature StrictMemorySafety -enable-experimental-feature LifetimeDependence -enable-experimental-feature CImplementation -enable-experimental-feature ExecutionAttribute -import-bridging-header %S/Inputs/attr_abi.h -parse-as-library -Rabi-inference -debugger-support
// RUN: %target-typecheck-verify-swift -enable-experimental-feature Extern -enable-experimental-feature ABIAttribute -enable-experimental-feature AddressableParameters -enable-experimental-feature NoImplicitCopy -enable-experimental-feature SymbolLinkageMarkers -enable-experimental-feature StrictMemorySafety -enable-experimental-feature LifetimeDependence -enable-experimental-feature CImplementation -import-bridging-header %S/Inputs/attr_abi.h -parse-as-library -Rabi-inference -debugger-support
// REQUIRES: swift_feature_ABIAttribute
// REQUIRES: swift_feature_AddressableParameters
// REQUIRES: swift_feature_CImplementation
// REQUIRES: swift_feature_ExecutionAttribute
// REQUIRES: swift_feature_Extern
// REQUIRES: swift_feature_LifetimeDependence
// REQUIRES: swift_feature_NoImplicitCopy

View File

@@ -1,7 +1,6 @@
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple -enable-experimental-feature ExecutionAttribute
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple
// REQUIRES: concurrency
// REQUIRES: swift_feature_ExecutionAttribute
// FIXME: Bad parser diagnostic on C++ side
nonisolated(something) func invalidAttr() async {} // expected-error {{cannot find 'nonisolated' in scope}}