Skip to content

Commit 55f9057

Browse files
Merge pull request #70453 from sophiapoirier/unguard-nonisolated-unsafe-feature
[Concurrency] unguard nonisolated(unsafe) attribute from GlobalConcurrency experimental feature
2 parents a237f63 + d319404 commit 55f9057

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

lib/ASTGen/Sources/ASTGen/SourceFile.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ extension Parser.ExperimentalFeatures {
5555
mapFeature(.TypedThrows, to: .typedThrows)
5656
mapFeature(.DoExpressions, to: .doExpressions)
5757
mapFeature(.NonEscapableTypes, to: .nonEscapableTypes)
58-
mapFeature(.GlobalConcurrency, to: .globalConcurrency)
5958
}
6059
}
6160

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5579,8 +5579,7 @@ bool Parser::isStartOfSwiftDecl(bool allowPoundIfAttributes,
55795579
}
55805580

55815581
// If this is 'nonisolated', check to see if it is valid.
5582-
if (Context.LangOpts.hasFeature(Feature::GlobalConcurrency) &&
5583-
Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
5582+
if (Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
55845583
isParenthesizedNonisolated(*this)) {
55855584
BacktrackingScope backtrack(*this);
55865585
consumeToken(tok::identifier);

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6858,14 +6858,11 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
68586858
auto dc = D->getDeclContext();
68596859

68606860
if (auto var = dyn_cast<VarDecl>(D)) {
6861-
const bool isUnsafe =
6862-
attr->isUnsafe() && Ctx.LangOpts.hasFeature(Feature::GlobalConcurrency);
6863-
68646861
// stored properties have limitations as to when they can be nonisolated.
68656862
if (var->hasStorage()) {
68666863
// 'nonisolated' can not be applied to mutable stored properties unless
68676864
// qualified as 'unsafe'.
6868-
if (var->supportsMutation() && !isUnsafe) {
6865+
if (var->supportsMutation() && !attr->isUnsafe()) {
68696866
diagnoseAndRemoveAttr(attr, diag::nonisolated_mutable_storage);
68706867
return;
68716868
}
@@ -6910,7 +6907,7 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
69106907

69116908
// nonisolated can not be applied to local properties unless qualified as
69126909
// 'unsafe'.
6913-
if (dc->isLocalContext() && !isUnsafe) {
6910+
if (dc->isLocalContext() && !attr->isUnsafe()) {
69146911
diagnoseAndRemoveAttr(attr, diag::nonisolated_local_var);
69156912
return;
69166913
}

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,8 +2834,7 @@ namespace {
28342834
return false;
28352835

28362836
if (auto attr = value->getAttrs().getAttribute<NonisolatedAttr>();
2837-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
2838-
attr->isUnsafe()) {
2837+
attr && attr->isUnsafe()) {
28392838
return false;
28402839
}
28412840

@@ -3306,8 +3305,7 @@ namespace {
33063305
}
33073306

33083307
if (auto attr = var->getAttrs().getAttribute<NonisolatedAttr>();
3309-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
3310-
attr->isUnsafe()) {
3308+
attr && attr->isUnsafe()) {
33113309
return false;
33123310
}
33133311

0 commit comments

Comments
 (0)