Skip to content

Commit 04c4309

Browse files
committed
Frontend: Alias NoncopyableGenerics to NoncopyableGenerics2.
To reduce churn always enable the experimental feature NoncopyableGenerics2 when NoncopyableGenerics is enabled.
1 parent 10e48cb commit 04c4309

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,18 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
883883
#else
884884
Opts.enableFeature(*feature);
885885
#endif
886+
887+
auto getFeatureAlias = [](Feature f) -> std::optional<Feature> {
888+
switch (f) {
889+
case Feature::NoncopyableGenerics:
890+
return Feature::NoncopyableGenerics2;
891+
default:
892+
return std::nullopt;
893+
}
894+
};
895+
896+
if (auto aliasFeature = getFeatureAlias(*feature))
897+
Opts.enableFeature(*aliasFeature);
886898
}
887899

888900
// Hack: In order to support using availability macros in SPM packages, we

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ function(_compile_swift_files
612612
list(APPEND swift_flags "-experimental-hermetic-seal-at-link")
613613
endif()
614614

615-
list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics2")
615+
list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics")
616616

617617
if(SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES)
618618
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")

test/ModuleInterface/noncopyable_generics.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// RUN: %empty-directory(%t)
22

33
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -emit-module \
4-
// RUN: -enable-experimental-feature NoncopyableGenerics2 \
4+
// RUN: -enable-experimental-feature NoncopyableGenerics \
55
// RUN: -enable-experimental-feature NonescapableTypes \
66
// RUN: -o %t/NoncopyableGenerics_Misc.swiftmodule \
77
// RUN: -emit-module-interface-path %t/NoncopyableGenerics_Misc.swiftinterface \
88
// RUN: %S/Inputs/NoncopyableGenerics_Misc.swift
99

1010
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -emit-module \
11-
// RUN: -enable-experimental-feature NoncopyableGenerics2 \
11+
// RUN: -enable-experimental-feature NoncopyableGenerics \
1212
// RUN: -enable-experimental-feature NonescapableTypes \
1313
// RUN: -enable-experimental-feature BorrowingSwitch \
1414
// RUN: -o %t/Swiftskell.swiftmodule \
@@ -23,17 +23,17 @@
2323
// See if we can compile a module through just the interface and typecheck using it.
2424

2525
// RUN: %target-swift-frontend -compile-module-from-interface \
26-
// RUN: -enable-experimental-feature NoncopyableGenerics2 \
26+
// RUN: -enable-experimental-feature NoncopyableGenerics \
2727
// RUN: -enable-experimental-feature NonescapableTypes \
2828
// RUN: %t/NoncopyableGenerics_Misc.swiftinterface -o %t/NoncopyableGenerics_Misc.swiftmodule
2929

3030
// RUN: %target-swift-frontend -compile-module-from-interface \
31-
// RUN: -enable-experimental-feature NoncopyableGenerics2 \
31+
// RUN: -enable-experimental-feature NoncopyableGenerics \
3232
// RUN: -enable-experimental-feature NonescapableTypes \
3333
// RUN: %t/Swiftskell.swiftinterface -o %t/Swiftskell.swiftmodule
3434

3535
// RUN: %target-swift-frontend -emit-silgen -I %t %s \
36-
// RUN: -enable-experimental-feature NoncopyableGenerics2 \
36+
// RUN: -enable-experimental-feature NoncopyableGenerics \
3737
// RUN: -enable-experimental-feature NonescapableTypes \
3838
// RUN: -o %t/final.silgen
3939

test/api-digester/compare-dump-abi-parsable-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: %empty-directory(%t.module-cache)
77

88
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
9-
// RUN: %target-swift-frontend -enable-experimental-feature NoncopyableGenerics2 -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
9+
// RUN: %target-swift-frontend -enable-experimental-feature NoncopyableGenerics -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
1010
// RUN: %api-digester -diagnose-sdk -print-module -module cake -BI %t.mod1 -BI %S/Inputs/APINotesLeft -I %t.mod2 -I %S/Inputs/APINotesRight -sdk %clang-importer-sdk-path -bsdk %clang-importer-sdk-path -module-cache-path %t.module-cache -o %t.result -abi
1111

1212
// RUN: %clang -E -P -x c %S/Outputs/Cake-abi.txt -o - | sed '/^\s*$/d' > %t.expected

test/api-digester/compare-dump-parsable-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: %empty-directory(%t.module-cache)
77

88
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
9-
// RUN: %target-swift-frontend -enable-experimental-feature NoncopyableGenerics2 -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
9+
// RUN: %target-swift-frontend -enable-experimental-feature NoncopyableGenerics -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache
1010
// RUN: %api-digester -diagnose-sdk -print-module -module cake -BI %t.mod1 -BI %S/Inputs/APINotesLeft -I %t.mod2 -I %S/Inputs/APINotesRight -sdk %clang-importer-sdk-path -bsdk %clang-importer-sdk-path -module-cache-path %t.module-cache -o %t.result
1111

1212
// RUN: %clang -E -P -x c %S/Outputs/Cake.txt -o - | sed '/^\s*$/d' > %t.expected

0 commit comments

Comments
 (0)