Skip to content

Commit b5acc6b

Browse files
committed
AST: Promote AsyncSequenceFailure feature to the baseline.
1 parent 6f972fc commit b5acc6b

File tree

5 files changed

+3
-42
lines changed

5 files changed

+3
-42
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,6 @@ struct PrintOptions {
372372
/// Whether to suppress printing of custom attributes that are expanded macros.
373373
bool SuppressExpandedMacros = true;
374374

375-
/// Whether we're supposed to slap a @rethrows on `AsyncSequence` /
376-
/// `AsyncIteratorProtocol` for backward-compatibility reasons.
377-
bool AsyncSequenceRethrows = false;
378-
379375
/// Suppress the @isolated(any) attribute.
380376
bool SuppressIsolatedAny = false;
381377

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated
170170
BASELINE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
171171
BASELINE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
172172
BASELINE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")
173-
SUPPRESSIBLE_LANGUAGE_FEATURE(AsyncSequenceFailure, 0, "Failure associated type on AsyncSequence and AsyncIteratorProtocol")
173+
BASELINE_LANGUAGE_FEATURE(AsyncSequenceFailure, 0, "Failure associated type on AsyncSequence and AsyncIteratorProtocol")
174174
BASELINE_LANGUAGE_FEATURE(BuiltinIntLiteralAccessors, 368, "Builtin.IntLiteral accessors")
175175
LANGUAGE_FEATURE(Macros, 0, "Macros")
176176
LANGUAGE_FEATURE(FreestandingExpressionMacros, 382, "Expression macros")

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,11 +1208,6 @@ static bool hasLessAccessibleSetter(const AbstractStorageDecl *ASD) {
12081208
return ASD->getSetterFormalAccess() < ASD->getFormalAccess();
12091209
}
12101210

1211-
static bool isImplicitRethrowsProtocol(const ProtocolDecl *proto) {
1212-
return proto->isSpecificProtocol(KnownProtocolKind::AsyncSequence) ||
1213-
proto->isSpecificProtocol(KnownProtocolKind::AsyncIteratorProtocol);
1214-
}
1215-
12161211
void PrintAST::printAttributes(const Decl *D) {
12171212
if (Options.SkipAttributes)
12181213
return;
@@ -1223,17 +1218,6 @@ void PrintAST::printAttributes(const Decl *D) {
12231218

12241219
auto attrs = D->getAttrs();
12251220

1226-
// When printing a Swift interface, make sure that older compilers see
1227-
// @rethrows on the AsyncSequence and AsyncIteratorProtocol.
1228-
if (Options.AsyncSequenceRethrows && Options.IsForSwiftInterface) {
1229-
if (auto proto = dyn_cast<ProtocolDecl>(D)) {
1230-
if (isImplicitRethrowsProtocol(proto)) {
1231-
Printer << "@rethrows";
1232-
Printer.printNewline();
1233-
}
1234-
}
1235-
}
1236-
12371221
// Save the current number of exclude attrs to restore once we're done.
12381222
unsigned originalExcludeAttrCount = Options.ExcludeAttrList.size();
12391223

@@ -3067,12 +3051,6 @@ static void suppressingFeaturePrimaryAssociatedTypes2(PrintOptions &options,
30673051
options.PrintPrimaryAssociatedTypes = originalPrintPrimaryAssociatedTypes;
30683052
}
30693053

3070-
static void
3071-
suppressingFeatureAsyncSequenceFailure(
3072-
PrintOptions &options, llvm::function_ref<void()> action) {
3073-
llvm::SaveAndRestore<bool> saved(options.AsyncSequenceRethrows, true);
3074-
action();
3075-
}
30763054
static void
30773055
suppressingFeatureLexicalLifetimes(PrintOptions &options,
30783056
llvm::function_ref<void()> action) {

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,6 @@ static bool usesFeaturePrimaryAssociatedTypes2(Decl *decl) {
150150
return false;
151151
}
152152

153-
static bool isImplicitRethrowsProtocol(const ProtocolDecl *proto) {
154-
return proto->isSpecificProtocol(KnownProtocolKind::AsyncSequence) ||
155-
proto->isSpecificProtocol(KnownProtocolKind::AsyncIteratorProtocol);
156-
}
157-
158-
static bool usesFeatureAsyncSequenceFailure(Decl *decl) {
159-
if (auto proto = dyn_cast<ProtocolDecl>(decl)) {
160-
return isImplicitRethrowsProtocol(proto);
161-
}
162-
163-
return false;
164-
}
165-
166153
static bool usesFeatureMacros(Decl *decl) { return isa<MacroDecl>(decl); }
167154

168155
static bool usesFeatureFreestandingExpressionMacros(Decl *decl) {

test/ModuleInterface/async_sequence_rethrows.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// REQUIRES: concurrency
66

7-
// CHECK: @rethrows
8-
// CHECK-NEXT: public protocol AsyncIteratorProtocol
7+
// CHECK-NOT: @rethrows
8+
// CHECK: public protocol AsyncIteratorProtocol
99
public protocol AsyncIteratorProtocol {
1010
}

0 commit comments

Comments
 (0)