Skip to content

Commit a4789dd

Browse files
sophiapoirierhborla
authored andcommitted
[Concurrency] unguard nonisolated(unsafe) attribute from GlobalConcurrency experimental feature
(cherry picked from commit d319404)
1 parent 44557a4 commit a4789dd

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
@@ -36,7 +36,6 @@ extension Parser.ExperimentalFeatures {
3636
}
3737
}
3838
mapFeature(.ThenStatements, to: .thenStatements)
39-
mapFeature(.GlobalConcurrency, to: .globalConcurrency)
4039
}
4140
}
4241

lib/Parse/ParseDecl.cpp

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

53465346
// If this is 'nonisolated', check to see if it is valid.
5347-
if (Context.LangOpts.hasFeature(Feature::GlobalConcurrency) &&
5348-
Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
5347+
if (Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
53495348
isParenthesizedNonisolated(*this)) {
53505349
BacktrackingScope backtrack(*this);
53515350
consumeToken(tok::identifier);

lib/Sema/TypeCheckAttr.cpp

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

65966596
if (auto var = dyn_cast<VarDecl>(D)) {
6597-
const bool isUnsafe =
6598-
attr->isUnsafe() && Ctx.LangOpts.hasFeature(Feature::GlobalConcurrency);
6599-
66006597
// stored properties have limitations as to when they can be nonisolated.
66016598
if (var->hasStorage()) {
66026599
// 'nonisolated' can not be applied to mutable stored properties unless
66036600
// qualified as 'unsafe'.
6604-
if (var->supportsMutation() && !isUnsafe) {
6601+
if (var->supportsMutation() && !attr->isUnsafe()) {
66056602
diagnoseAndRemoveAttr(attr, diag::nonisolated_mutable_storage);
66066603
return;
66076604
}
@@ -6645,7 +6642,7 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
66456642

66466643
// nonisolated can not be applied to local properties unless qualified as
66476644
// 'unsafe'.
6648-
if (dc->isLocalContext() && !isUnsafe) {
6645+
if (dc->isLocalContext() && !attr->isUnsafe()) {
66496646
diagnoseAndRemoveAttr(attr, diag::nonisolated_local_var);
66506647
return;
66516648
}

lib/Sema/TypeCheckConcurrency.cpp

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

28152815
if (auto attr = value->getAttrs().getAttribute<NonisolatedAttr>();
2816-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
2817-
attr->isUnsafe()) {
2816+
attr && attr->isUnsafe()) {
28182817
return false;
28192818
}
28202819

@@ -3282,8 +3281,7 @@ namespace {
32823281
}
32833282

32843283
if (auto attr = var->getAttrs().getAttribute<NonisolatedAttr>();
3285-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
3286-
attr->isUnsafe()) {
3284+
attr && attr->isUnsafe()) {
32873285
return false;
32883286
}
32893287

0 commit comments

Comments
 (0)