Skip to content

Commit 654f853

Browse files
authored
Merge pull request #79399 from DougGregor/enable-span-everywhere
Enable usable of Span by default
2 parents abf3b32 + 3c8ef82 commit 654f853

25 files changed

+23
-93
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7981,10 +7981,6 @@ ERROR(noncopyable_cannot_have_read_set_accessor,none,
79817981
"noncopyable %select{variable|subscript}0 cannot provide a read and set accessor",
79827982
(unsigned))
79837983

7984-
ERROR(span_requires_feature_flag,none,
7985-
"'%0' requires -enable-experimental-feature Span",
7986-
(StringRef))
7987-
79887984
//------------------------------------------------------------------------------
79897985
// MARK: Init accessors
79907986
//------------------------------------------------------------------------------

include/swift/Basic/Features.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ EXPERIMENTAL_FEATURE(MacrosOnImports, true)
234234
EXPERIMENTAL_FEATURE(TupleConformances, false)
235235
EXPERIMENTAL_FEATURE(FullTypedThrows, false)
236236
EXPERIMENTAL_FEATURE(SameElementRequirements, false)
237-
EXPERIMENTAL_FEATURE(Span, true)
238237

239238
// Whether to enable @_used and @_section attributes
240239
EXPERIMENTAL_FEATURE(SymbolLinkageMarkers, true)

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ UNINTERESTING_FEATURE(GroupActorErrors)
197197
UNINTERESTING_FEATURE(SameElementRequirements)
198198
UNINTERESTING_FEATURE(UnspecifiedMeansMainActorIsolated)
199199
UNINTERESTING_FEATURE(GenerateForceToMainActorThunks)
200-
UNINTERESTING_FEATURE(Span)
201200

202201
static bool usesFeatureSendingArgsAndResults(Decl *decl) {
203202
auto isFunctionTypeWithSending = [](Type type) {

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,32 +1730,6 @@ static void diagnoseGenericArgumentsOnSelf(const TypeResolution &resolution,
17301730
}
17311731
}
17321732

1733-
/// Diagnose when this is one of the Span types, which currently requires
1734-
/// an experimental feature to use.
1735-
static void diagnoseSpanType(TypeDecl *typeDecl, SourceLoc loc,
1736-
const DeclContext *dc) {
1737-
if (loc.isInvalid())
1738-
return;
1739-
1740-
if (!typeDecl->isStdlibDecl())
1741-
return;
1742-
1743-
ASTContext &ctx = typeDecl->getASTContext();
1744-
if (ctx.LangOpts.hasFeature(Feature::Span))
1745-
return;
1746-
1747-
auto nameString = typeDecl->getName().str();
1748-
if (nameString != "Span" && nameString != "RawSpan")
1749-
return;
1750-
1751-
// Don't require this in the standard library or _Concurrency library.
1752-
auto module = dc->getParentModule();
1753-
if (module->isStdlibModule() || module->getName().str() == "_Concurrency")
1754-
return;
1755-
1756-
ctx.Diags.diagnose(loc, diag::span_requires_feature_flag, nameString);
1757-
}
1758-
17591733
/// Resolve the given identifier type representation as an unqualified type,
17601734
/// returning the type it references.
17611735
/// \param silContext Used to look up generic parameters in SIL mode.
@@ -1892,8 +1866,6 @@ resolveUnqualifiedIdentTypeRepr(const TypeResolution &resolution,
18921866
return ErrorType::get(ctx);
18931867
}
18941868

1895-
diagnoseSpanType(currentDecl, repr->getLoc(), DC);
1896-
18971869
repr->setValue(currentDecl, currentDC);
18981870
return current;
18991871
}
@@ -2114,8 +2086,6 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
21142086
member = memberTypes.back().Member;
21152087
inferredAssocType = memberTypes.back().InferredAssociatedType;
21162088
repr->setValue(member, nullptr);
2117-
2118-
diagnoseSpanType(member, repr->getLoc(), DC);
21192089
}
21202090

21212091
return maybeDiagnoseBadMemberType(member, memberType, inferredAssocType);

test/Interop/C/swiftify-import/counted-by-noescape.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REQUIRES: swift_feature_SafeInteropWrappers
2-
// REQUIRES: swift_feature_Span
32

4-
// RUN: %target-swift-ide-test -print-module -module-to-print=CountedByNoEscapeClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers -enable-experimental-feature Span | %FileCheck %s
3+
// RUN: %target-swift-ide-test -print-module -module-to-print=CountedByNoEscapeClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers | %FileCheck %s
54

65
// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well
76
// RUN: %empty-directory(%t)

test/Interop/C/swiftify-import/sized-by-noescape.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REQUIRES: swift_feature_SafeInteropWrappers
2-
// REQUIRES: swift_feature_Span
32

4-
// RUN: %target-swift-ide-test -print-module -module-to-print=SizedByNoEscapeClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers -enable-experimental-feature Span | %FileCheck %s
3+
// RUN: %target-swift-ide-test -print-module -module-to-print=SizedByNoEscapeClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers | %FileCheck %s
54

65
// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well
76
// RUN: %empty-directory(%t)

test/Interop/Cxx/stdlib/std-span-interface.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-ide-test -plugin-path %swift-plugin-dir -I %S/Inputs -enable-experimental-feature LifetimeDependence -enable-experimental-feature Span -enable-experimental-feature SafeInteropWrappers -print-module -module-to-print=StdSpan -source-filename=x -enable-experimental-cxx-interop -Xcc -std=c++20 -module-cache-path %t > %t/interface.swift
2+
// RUN: %target-swift-ide-test -plugin-path %swift-plugin-dir -I %S/Inputs -enable-experimental-feature LifetimeDependence -enable-experimental-feature SafeInteropWrappers -print-module -module-to-print=StdSpan -source-filename=x -enable-experimental-cxx-interop -Xcc -std=c++20 -module-cache-path %t > %t/interface.swift
33
// RUN: %FileCheck %s < %t/interface.swift
44

55
// REQUIRES: swift_feature_SafeInteropWrappers
6-
// REQUIRES: swift_feature_Span
76
// REQUIRES: swift_feature_LifetimeDependence
87

98
// FIXME swift-ci linux tests do not support std::span

test/Macros/SwiftifyImport/CountedBy/MutableSpan.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: swift_feature_Span
32

4-
// RUN: not %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -enable-experimental-feature Span > %t.log 2>&1
3+
// RUN: not %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions > %t.log 2>&1
54
// RUN: %FileCheck --match-full-lines %s < %t.log
65

76
@_SwiftifyImport(.countedBy(pointer: .param(1), count: "len"), .nonescaping(pointer: .param(1)))

test/Macros/SwiftifyImport/CountedBy/SimpleSpan.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: swift_feature_Span
32

4-
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -enable-experimental-feature Span 2>&1 | %FileCheck --match-full-lines %s
3+
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s
54

65
@_SwiftifyImport(.countedBy(pointer: .param(1), count: "len"), .nonescaping(pointer: .param(1)))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {

test/Macros/SwiftifyImport/CountedBy/SimpleSpanWithReturn.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: swift_feature_Span
32

4-
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -enable-experimental-feature Span 2>&1 | %FileCheck --match-full-lines %s
3+
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s
54

65
@_SwiftifyImport(.countedBy(pointer: .param(1), count: "len"), .nonescaping(pointer: .param(1)))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) -> CInt {

0 commit comments

Comments
 (0)