Skip to content

Commit 21b303f

Browse files
authored
Merge pull request swiftlang#73501 from kavon/ncgeneric-not-experimental
NCGenerics: it's not experimental
2 parents 0f606e7 + b04be89 commit 21b303f

File tree

146 files changed

+86
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+86
-268
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ LANGUAGE_FEATURE(MoveOnlyPartialConsumption, 429, "Partial consumption of noncop
179179
/// Enable bitwise-copyable feature.
180180
LANGUAGE_FEATURE(BitwiseCopyable, 426, "BitwiseCopyable protocol")
181181
SUPPRESSIBLE_LANGUAGE_FEATURE(ConformanceSuppression, 426, "Suppressible inferred conformances")
182+
SUPPRESSIBLE_LANGUAGE_FEATURE(NoncopyableGenerics, 427, "Noncopyable generics")
182183

183184
// Swift 6
184185
UPCOMING_FEATURE(ConciseMagicFile, 274, 6)
@@ -324,9 +325,6 @@ EXPERIMENTAL_FEATURE(Embedded, true)
324325
/// Enables importing the Volatile module
325326
EXPERIMENTAL_FEATURE(Volatile, true)
326327

327-
/// Enables noncopyable generics
328-
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(NoncopyableGenerics, true)
329-
330328
// Alias for NoncopyableGenerics
331329
EXPERIMENTAL_FEATURE(NoncopyableGenerics2, true)
332330

lib/ClangImporter/ClangImporter.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5795,20 +5795,6 @@ cloneBaseMemberDecl(ValueDecl *decl, DeclContext *newContext) {
57955795
}
57965796

57975797
if (auto var = dyn_cast<VarDecl>(decl)) {
5798-
auto oldContext = var->getDeclContext();
5799-
auto oldTypeDecl = oldContext->getSelfNominalTypeDecl();
5800-
// If the base type is non-copyable, and non-copyable generics are disabled,
5801-
// we cannot synthesize the accessor, because its implementation would use
5802-
// `UnsafePointer<BaseTy>`.
5803-
// We cannot use `ty->isNoncopyable()` here because that would create a
5804-
// cyclic dependency between ModuleQualifiedLookupRequest and
5805-
// LookupConformanceInModuleRequest, so we check for the presence of
5806-
// move-only attribute that is implicitly added to non-copyable C++ types by
5807-
// ClangImporter.
5808-
if (oldTypeDecl->getAttrs().hasAttribute<MoveOnlyAttr>() &&
5809-
!context.LangOpts.hasFeature(Feature::NoncopyableGenerics))
5810-
return nullptr;
5811-
58125798
auto rawMemory = allocateMemoryForDecl<VarDecl>(var->getASTContext(),
58135799
sizeof(VarDecl), false);
58145800
auto out =

lib/ClangImporter/ImportType.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -509,26 +509,6 @@ namespace {
509509
return importFunctionPointerLikeType(*type, pointeeType);
510510
}
511511

512-
// If non-copyable generics are disabled, we cannot specify
513-
// UnsafePointer<T> with a non-copyable type T.
514-
// We cannot use `ty->isNoncopyable()` here because that would create a
515-
// cyclic dependency between ModuleQualifiedLookupRequest and
516-
// LookupConformanceInModuleRequest, so we check for the presence of
517-
// move-only attribute that is implicitly added to non-copyable C++ types
518-
// by ClangImporter.
519-
if (pointeeType && pointeeType->getAnyNominal() &&
520-
pointeeType->getAnyNominal()
521-
->getAttrs()
522-
.hasAttribute<MoveOnlyAttr>() &&
523-
!Impl.SwiftContext.LangOpts.hasFeature(
524-
Feature::NoncopyableGenerics)) {
525-
auto opaquePointerDecl = Impl.SwiftContext.getOpaquePointerDecl();
526-
if (!opaquePointerDecl)
527-
return Type();
528-
return {opaquePointerDecl->getDeclaredInterfaceType(),
529-
ImportHint::OtherPointer};
530-
}
531-
532512
PointerTypeKind pointerKind;
533513
if (quals.hasConst()) {
534514
pointerKind = PTK_UnsafePointer;

test/Concurrency/transfernonsendable_instruction_matching.sil

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-sil-opt -transfer-non-sendable -enable-upcoming-feature RegionBasedIsolation -strict-concurrency=complete %s -verify -o /dev/null
2-
// RUN: %target-sil-opt -enable-experimental-feature NoncopyableGenerics -transfer-non-sendable -enable-upcoming-feature RegionBasedIsolation -strict-concurrency=complete %s -verify -o /dev/null
32

43
// REQUIRES: concurrency
54
// REQUIRES: asserts
@@ -1797,4 +1796,4 @@ bb0:
17971796

17981797
%9999 = tuple ()
17991798
return %9999 : $()
1800-
}
1799+
}

test/Generics/copyable_and_self_conforming_protocols.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -enable-experimental-feature NoncopyableGenerics -enable-experimental-feature NonescapableTypes %s -verify
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -enable-experimental-feature NonescapableTypes %s -verify
22

33
// REQUIRES: objc_interop
44
// REQUIRES: asserts

test/Generics/inverse_associatedtype_restriction.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift \
2-
// RUN: -enable-experimental-feature NoncopyableGenerics \
32
// RUN: -enable-experimental-feature NonescapableTypes
43

54
// The restriction is that we don't permit suppression requirements on

test/Generics/inverse_classes1.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// RUN: %target-typecheck-verify-swift \
22
// RUN: -parse-stdlib -module-name Swift \
3-
// RUN: -enable-experimental-feature MoveOnlyClasses \
4-
// RUN: -enable-experimental-feature NoncopyableGenerics
3+
// RUN: -enable-experimental-feature MoveOnlyClasses
54

65
// NOTE: -parse-stdlib is a transitional workaround and should not be required.
76

test/Generics/inverse_classes2.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-typecheck-verify-swift \
2-
// RUN: -parse-stdlib -module-name Swift \
3-
// RUN: -enable-experimental-feature NoncopyableGenerics
2+
// RUN: -parse-stdlib -module-name Swift
43

54
// NOTE: -parse-stdlib is a transitional workaround and should not be required.
65

test/Generics/inverse_conditional_conformance_restriction.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift \
2-
// RUN: -enable-experimental-feature NoncopyableGenerics \
32
// RUN: -enable-experimental-feature NonescapableTypes \
43
// RUN: -enable-experimental-feature SuppressedAssociatedTypes
54

test/Generics/inverse_copyable_requirement.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift
2-
// RUN: %target-typecheck-verify-swift -enable-experimental-feature NoncopyableGenerics
32

43
// a concrete move-only type
54
struct MO: ~Copyable {

0 commit comments

Comments
 (0)