Skip to content

Commit 9c37687

Browse files
committed
Frontend: Introduce an alias for the NoncopyableGenerics experimental feature.
The `.swiftinterface` of the standard library must remain compatible with some older compilers. Unfortunately, some of those older compilers do not allow the experimental feature `NoncopyableGenerics` to be enabled in production. To allow the stdlib to build with non-copyable generics enabled and still have the older compilers consume its interface, we have to use a new experimental feature identifier that they do not know about. Partially resolves rdar://125138945
1 parent abc42e8 commit 9c37687

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

include/swift/Basic/Features.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ EXPERIMENTAL_FEATURE(Embedded, true)
319319
/// Enables noncopyable generics
320320
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(NoncopyableGenerics, true)
321321

322+
// Alias for NoncopyableGenerics
323+
EXPERIMENTAL_FEATURE(NoncopyableGenerics2, true)
324+
322325
/// Allow destructuring stored `let` bindings in structs.
323326
EXPERIMENTAL_FEATURE(StructLetDestructuring, true)
324327

lib/AST/FeatureSet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ static bool usesFeatureNoncopyableGenerics(Decl *decl) {
568568
return !inverseReqs.empty();
569569
}
570570

571+
UNINTERESTING_FEATURE(NoncopyableGenerics2)
572+
571573
static bool usesFeatureStructLetDestructuring(Decl *decl) {
572574
auto sd = dyn_cast<StructDecl>(decl);
573575
if (!sd)

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
883883
#else
884884
Opts.enableFeature(*feature);
885885
#endif
886+
887+
if (*feature == Feature::NoncopyableGenerics2)
888+
Opts.enableFeature(Feature::NoncopyableGenerics);
886889
}
887890

888891
// 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" "NoncopyableGenerics")
615+
list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics2")
616616

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

0 commit comments

Comments
 (0)