Skip to content

[6.0][Concurrency] Remove -disable-region-based-isolation-with-strict-concurrency. #74579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -1352,11 +1352,6 @@ def disable_experimental_parser_round_trip : Flag<["-"],
"disable-experimental-parser-round-trip">,
HelpText<"Disable round trip through the new swift parser">;

def disable_strict_concurrency_region_based_isolation : Flag<["-"],
"disable-region-based-isolation-with-strict-concurrency">,
HelpText<"Disable region based isolation when running with strict concurrency enabled. Only enabled with asserts">,
Flags<[HelpHidden]>;

def disable_transferring_args_and_results_with_region_isolation : Flag<["-"],
"disable-transferring-args-and-results-with-region-based-isolation">,
HelpText<"Disable transferring args and results when region based isolation is enabled. Only enabled with asserts">,
Expand Down
7 changes: 1 addition & 6 deletions lib/DriverTool/sil_opt_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,6 @@ struct SILOptOptions {
"Xcc",
llvm::cl::desc("option to pass to clang"));

llvm::cl::opt<bool> DisableRegionBasedIsolationWithStrictConcurrency =
llvm::cl::opt<bool>(
"disable-region-based-isolation-with-strict-concurrency",
llvm::cl::init(false));
};

/// Regular expression corresponding to the value given in one of the
Expand Down Expand Up @@ -706,8 +702,7 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
if (options.StrictConcurrencyLevel.hasArgStr()) {
Invocation.getLangOptions().StrictConcurrencyLevel =
options.StrictConcurrencyLevel;
if (options.StrictConcurrencyLevel == StrictConcurrency::Complete &&
!options.DisableRegionBasedIsolationWithStrictConcurrency) {
if (options.StrictConcurrencyLevel == StrictConcurrency::Complete) {
Invocation.getLangOptions().enableFeature(Feature::RegionBasedIsolation);
}
}
Expand Down
11 changes: 1 addition & 10 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,16 +1098,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Opts.StrictConcurrencyLevel == StrictConcurrency::Complete) {
Opts.enableFeature(Feature::IsolatedDefaultValues);
Opts.enableFeature(Feature::GlobalConcurrency);

// If asserts are enabled, allow for region based isolation to be disabled
// with a flag. This is intended only to be used with tests.
bool enableRegionIsolation = true;
#ifndef NDEBUG
enableRegionIsolation =
!Args.hasArg(OPT_disable_strict_concurrency_region_based_isolation);
#endif
if (enableRegionIsolation)
Opts.enableFeature(Feature::RegionBasedIsolation);
Opts.enableFeature(Feature::RegionBasedIsolation);
}

Opts.WarnImplicitOverrides =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=complete

// REQUIRES: concurrency
Expand Down
21 changes: 4 additions & 17 deletions test/Concurrency/actor_call_implicitly_async.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -enable-upcoming-feature InferSendableFromCaptures -parse-as-library %s -emit-sil -o /dev/null -verify

// REQUIRES: concurrency
// REQUIRES: asserts
Expand Down Expand Up @@ -291,35 +290,23 @@ func blender(_ peeler : () -> Void) {


await wisk({})
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
await wisk(1)
await (peelBanana)()
await (((((peelBanana)))))()
await (((wisk)))((wisk)((wisk)(1)))

blender((peelBanana))
// expected-warning@-1 {{converting function value of type '@BananaActor () -> ()' to '() -> Void' loses global actor 'BananaActor'}}
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable () -> ()' to '() -> Void' loses global actor 'BananaActor'}}

await wisk(peelBanana)
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}

await wisk(wisk)
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
await (((wisk)))(((wisk)))
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}

await {wisk}()(1)

// FIXME: Poor diagnostic. The issue is that the invalid function conversion
// to remove '@BananaActor' on 'wisk' cannot influence which solution is chosen.
// So, the constraint system cannot determine whether the type of this expression
// is '(Any) -> Void' or '@BananaActor (Any) -> Void'.
await (true ? wisk : {n in return})(1)
// expected-error@-1 {{type of expression is ambiguous without a type annotation}}
(true ? wisk : {n in return})(1)
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable (Any) -> ()' to '(Any) -> ()' loses global actor 'BananaActor'; this is an error in the Swift 6 language mode}}
}

actor Chain {
Expand Down
12 changes: 3 additions & 9 deletions test/Concurrency/actor_inout_isolation.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-targeted- -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix targeted-complete- -verify-additional-prefix minimal-targeted- -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix targeted-complete- -verify-additional-prefix complete-tns- -verify-additional-prefix complete- -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix complete-tns- -strict-concurrency=complete

// REQUIRES: concurrency
Expand Down Expand Up @@ -101,7 +99,7 @@ extension TestActor {

// external class method call
@available(SwiftStdlib 5.1, *)
class NonAsyncClass { // expected-targeted-complete-note {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
class NonAsyncClass {
// expected-targeted-complete-tns-note @-1 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
// expected-tns-note @-2 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
func modifyOtherAsync(_ other : inout Int) async {
Expand All @@ -124,7 +122,6 @@ extension TestActor {
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' exiting actor-isolated context in call to non-isolated instance method 'modifyOtherAsync' cannot cross actor boundary}}
await other.modifyOtherAsync(&value2)
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
// expected-targeted-complete-warning @-2 {{passing argument of non-sendable type 'NonAsyncClass' outside of actor-isolated context may introduce data races}}

await otherCurry(&value1)
// expected-error @-1 {{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
Expand All @@ -134,13 +131,11 @@ extension TestActor {
}

func callMutatingFunctionOnStruct() async {
// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
// expected-error@+2:38{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
// expected-error@+1:58{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
await position.setComponents(x: &nextPosition.x, y: &nextPosition.y)

// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
// expected-error@+2:38{{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
// expected-error@+1:50{{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
Expand Down Expand Up @@ -224,7 +219,7 @@ struct MyGlobalActor {
if #available(SwiftStdlib 5.1, *) {
let _ = Task.detached { await { (_ foo: inout Int) async in foo += 1 }(&number) }
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
// expected-minimal-targeted-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a non-isolated context}}
}

Expand Down Expand Up @@ -319,6 +314,5 @@ actor ProtectDictionary {
func invalid() async {
await dict[0].mutate()
// expected-warning@-1 {{cannot call mutating async function 'mutate()' on actor-isolated property 'dict'; this is an error in the Swift 6 language mode}}
// expected-targeted-complete-warning@-2 {{passing argument of non-sendable type 'inout Optional<Int>' outside of actor-isolated context may introduce data races}}
}
}
2 changes: 0 additions & 2 deletions test/Concurrency/async_cancellation.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete

// REQUIRES: concurrency
Expand Down
3 changes: 0 additions & 3 deletions test/Concurrency/async_let_isolation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
// Then with targeted.
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix without-transferring-

// Then with strict concurrency without region isolation.
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency -verify-additional-prefix without-transferring-

// Then strict-concurrency with everything.
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns-

Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/async_sequence_syntax.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete

// REQUIRES: concurrency
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/concurrency_warnings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// RUN: %target-swift-frontend -emit-module -emit-module-path %t/GlobalVariables.swiftmodule -module-name GlobalVariables %S/Inputs/GlobalVariables.swift -disable-availability-checking -parse-as-library

// RUN: %target-swift-frontend -I %t -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -I %t -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify

// REQUIRES: concurrency
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/concurrent_value_checking.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify

// REQUIRES: concurrency
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/concurrent_value_checking_objc.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify

// REQUIRES: concurrency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency=complete -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify -verify-additional-prefix region-isolation- %s
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency -emit-sil -o /dev/null -verify %s
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency=complete -emit-sil -o /dev/null -verify %s
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify %s

// REQUIRES: concurrency
// REQUIRES: asserts
Expand Down
5 changes: 2 additions & 3 deletions test/Concurrency/global_actor_from_ordinary_context.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix complete-and-tns- -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix complete-and-tns- -verify -strict-concurrency=complete

// REQUIRES: concurrency
Expand Down
3 changes: 0 additions & 3 deletions test/Concurrency/global_actor_function_types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
// Emit SIL with targeted concurrency.
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix without-transferring-

// Emit SIL with strict concurrency but without region based isolation
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix complete-tns- -verify-additional-prefix without-transferring- -disable-region-based-isolation-with-strict-concurrency

// Emit SIL with strict concurrency + region based isolation + transferring
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix complete-tns-

Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/isolated_captures.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// RUN: %target-swift-frontend -verify -disable-availability-checking -strict-concurrency=complete -verify-additional-prefix complete- -emit-sil -o /dev/null %s -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -verify -disable-availability-checking -strict-concurrency=complete -verify-additional-prefix region-isolation- -emit-sil -o /dev/null %s

// REQUIRES: concurrency
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/isolated_parameters.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify

// REQUIRES: asserts
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/issue-57376.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=targeted %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-and-complete-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns- -verify-additional-prefix no-transferring-tns- -disable-region-based-isolation-with-strict-concurrency
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns- -verify-additional-prefix transferring-tns-

// REQUIRES: concurrency
Expand Down
3 changes: 1 addition & 2 deletions test/Concurrency/predates_concurrency_import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/OtherActors.swiftmodule -module-name OtherActors %S/Inputs/OtherActors.swift -disable-availability-checking

// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -parse-as-library -enable-upcoming-feature GlobalConcurrency
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency -parse-as-library -enable-upcoming-feature GlobalConcurrency
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency -parse-as-library -enable-upcoming-feature GlobalConcurrency
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -parse-as-library -enable-upcoming-feature GlobalConcurrency
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -parse-as-library -enable-upcoming-feature GlobalConcurrency

// REQUIRES: concurrency
Expand Down
Loading