Skip to content

Commit 3c8ef82

Browse files
committed
Enable usable of Span by default
Usage of Span was temporarily behind an experimental feature flag. Now that SE-0447 has been accepted, remove the experimental feature flag and allow Span usage everywhere. Implements rdar://144819992.
1 parent e24598b commit 3c8ef82

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
@@ -7980,10 +7980,6 @@ ERROR(noncopyable_cannot_have_read_set_accessor,none,
79807980
"noncopyable %select{variable|subscript}0 cannot provide a read and set accessor",
79817981
(unsigned))
79827982

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

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
@@ -1724,32 +1724,6 @@ static void diagnoseGenericArgumentsOnSelf(const TypeResolution &resolution,
17241724
}
17251725
}
17261726

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

1889-
diagnoseSpanType(currentDecl, repr->getLoc(), DC);
1890-
18911863
repr->setValue(currentDecl, currentDC);
18921864
return current;
18931865
}
@@ -2108,8 +2080,6 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
21082080
member = memberTypes.back().Member;
21092081
inferredAssocType = memberTypes.back().InferredAssociatedType;
21102082
repr->setValue(member, nullptr);
2111-
2112-
diagnoseSpanType(member, repr->getLoc(), DC);
21132083
}
21142084

21152085
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)