Skip to content

Commit 1560e08

Browse files
authored
Merge pull request #69281 from jckarter/enable-move-only-resilient-types
Enable MoveOnlyResilientTypes feature.
2 parents 2776c51 + 7dbab5e commit 1560e08

13 files changed

+16
-65
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ LANGUAGE_FEATURE(
107107
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", hasSwiftSwiftParser)
108108
LANGUAGE_FEATURE(ExtensionMacros, 402, "Extension macros", hasSwiftSwiftParser)
109109
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
110+
LANGUAGE_FEATURE(MoveOnlyResilientTypes, 390, "non-@frozen noncopyable types with library evolution", true)
110111
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
111112
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", true)
112113
LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros", true)
@@ -142,7 +143,6 @@ EXPERIMENTAL_FEATURE(NoImplicitCopy, true)
142143
EXPERIMENTAL_FEATURE(OldOwnershipOperatorSpellings, true)
143144
EXPERIMENTAL_FEATURE(MoveOnlyEnumDeinits, true)
144145
EXPERIMENTAL_FEATURE(MoveOnlyTuples, true)
145-
EXPERIMENTAL_FEATURE(MoveOnlyResilientTypes, true)
146146
EXPERIMENTAL_FEATURE(MoveOnlyPartialConsumption, true)
147147

148148
EXPERIMENTAL_FEATURE(OneWayClosureParameters, false)

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,12 +2758,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27582758
ED->getBaseIdentifier());
27592759
}
27602760
}
2761-
2762-
if (!ED->getASTContext().LangOpts.hasFeature(
2763-
Feature::MoveOnlyResilientTypes) &&
2764-
ED->isResilient()) {
2765-
ED->diagnose(diag::noncopyable_types_cannot_be_resilient, ED);
2766-
}
27672761
}
27682762
}
27692763

@@ -2804,12 +2798,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
28042798
diagnoseCopyableTypeContainingMoveOnlyType(SD);
28052799

28062800
diagnoseIncompatibleProtocolsForMoveOnlyType(SD);
2807-
2808-
if (!SD->getASTContext().LangOpts.hasFeature(
2809-
Feature::MoveOnlyResilientTypes) &&
2810-
SD->isResilient() && SD->isNoncopyable()) {
2811-
SD->diagnose(diag::noncopyable_types_cannot_be_resilient, SD);
2812-
}
28132801
}
28142802

28152803
/// Check whether the given properties can be @NSManaged in this class.

test/IRGen/moveonly_split_module_source_deinit_library_evolution.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION -enable-experimental-feature MoveOnlyResilientTypes
2+
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION
33
// RUN: %target-codesign %t/%target-library-name(MoveOnlySplit)
44

5-
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t) -enable-experimental-feature MoveOnlyResilientTypes
5+
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t)
66
// RUN: %target-codesign %t/main
77
// RUN: %target-run %t/main %t/%target-library-name(MoveOnlySplit) | %FileCheck -check-prefix=CHECK-LIBRARY-EVOLUTION %s
88

test/ModuleInterface/discard_interface.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -verify -enable-experimental-feature MoveOnlyResilientTypes
3-
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t -enable-experimental-feature MoveOnlyResilientTypes
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -verify
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
44
// RUN: %FileCheck %s < %t/Library.swiftinterface
55

66
// This test makes sure that discard is emitted correctly in the interfaces.

test/ModuleInterface/moveonly_interface_flag.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -enable-experimental-feature MoveOnlyResilientTypes
3-
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t -enable-experimental-feature MoveOnlyResilientTypes
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
44
// RUN: %FileCheck %s < %t/Library.swiftinterface
55

66
// this test makes sure that decls containing a move-only type are guarded by the $MoveOnly feature flag

test/ModuleInterface/moveonly_user.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// RUN: %target-swift-frontend -emit-sil -sil-verify-all -I %t %s > /dev/null
66

77
// >> now again with library evolution; we expect the same result.
8-
// RUN: %target-swift-frontend -DSYNTHESIZE_ACCESSORS -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes -emit-module -o %t/Hello.swiftmodule %S/Inputs/moveonly_api.swift
9-
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyResilientTypes -emit-sil -sil-verify-all -I %t %s > /dev/null
8+
// RUN: %target-swift-frontend -DSYNTHESIZE_ACCESSORS -enable-library-evolution -emit-module -o %t/Hello.swiftmodule %S/Inputs/moveonly_api.swift
9+
// RUN: %target-swift-frontend -emit-sil -sil-verify-all -I %t %s > /dev/null
1010

1111
// FIXME: ideally this would also try executing the program rather than just generating SIL
1212

test/SILGen/moveonly_library_evolution.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-emit-silgen -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution %s | %FileCheck %s
2-
// RUN: %target-swift-emit-sil -O -sil-verify-all -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution %s
1+
// RUN: %target-swift-emit-silgen -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-library-evolution %s | %FileCheck %s
2+
// RUN: %target-swift-emit-sil -O -sil-verify-all -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-library-evolution %s
33

44
////////////////////////
55
// MARK: Declarations //

test/SILOptimizer/moveonly_addresschecker_diagnostics_library_evolution.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes %s
1+
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify -enable-library-evolution %s
22

33
// This test is used to validate that we properly handle library evolution code
44
// until we can get all of the normal moveonly_addresschecker_diagnostics test

test/SILOptimizer/moveonly_deinit_devirtualization_library_evolution.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-library-evolution -module-name main -enable-sil-verify-all -sil-move-only-deinit-devirtualization -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyEnumDeinits -enable-experimental-feature MoveOnlyResilientTypes %s | %FileCheck %s
1+
// RUN: %target-sil-opt -enable-library-evolution -module-name main -enable-sil-verify-all -sil-move-only-deinit-devirtualization -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyEnumDeinits %s | %FileCheck %s
22

33
sil_stage raw
44

test/SILOptimizer/moveonly_loadable_to_address_reabstraction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-sil -verify -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes %s
1+
// RUN: %target-swift-frontend -emit-sil -verify -enable-library-evolution %s
22

33
// Verify that call sequences that require reabstracting a noncopyable value
44
// from a loadable representation to an in-memory one are properly allowed by

test/SILOptimizer/moveonly_resilient_property_reader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution -emit-sil %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -enable-library-evolution -emit-sil %s | %FileCheck %s
22

33
public struct ResilientMemberC {}
44
public struct ResilientMemberNC: ~Copyable {}

test/Sema/discard_module.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// RUN: %target-typecheck-verify-swift -I %t
66

77
// >> now again with library evolution; we expect the same result.
8-
// RUN: %target-swift-frontend -enable-library-evolution -emit-module -o %t/SorryModule.swiftmodule %S/Inputs/discard_module_defining.swift %S/Inputs/discard_module_adjacent.swift -enable-experimental-feature MoveOnlyResilientTypes
8+
// RUN: %target-swift-frontend -enable-library-evolution -emit-module -o %t/SorryModule.swiftmodule %S/Inputs/discard_module_defining.swift %S/Inputs/discard_module_adjacent.swift
99
// RUN: %target-typecheck-verify-swift -I %t
1010

1111
// "Sorry" is meaningless

test/Sema/moveonly_resilient_type.swift

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)