4848// for features that can be assumed to be available in any Swift compiler that
4949// will be used to process the textual interface files produced by this
5050// Swift compiler.
51+ //
52+ // OPTIONAL_LANGUAGE_FEATURE is the same as LANGUAGE_FEATURE, but describes
53+ // accepted features that can be enabled independently of language version and
54+ // are not scheduled to be enabled in some specific language version. Examples
55+ // of optional language features include strict memory safety checking (SE-0458)
56+ // and Embedded Swift.
5157// ===----------------------------------------------------------------------===//
5258
5359#ifndef LANGUAGE_FEATURE
8995 LANGUAGE_FEATURE (FeatureName, SENumber, Description)
9096#endif
9197
98+ #ifndef OPTIONAL_LANGUAGE_FEATURE
99+ # define OPTIONAL_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
100+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
101+ #endif
102+
92103// A feature that's both conditionally-suppressible and experimental.
93104// Delegates to whichever the includer defines.
94105#ifndef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
@@ -203,6 +214,7 @@ LANGUAGE_FEATURE(IsolatedAny2, 431, "@isolated(any) function types")
203214LANGUAGE_FEATURE(ObjCImplementation, 436 , " @objc @implementation extensions" )
204215LANGUAGE_FEATURE(NonescapableTypes, 446 , " Nonescapable types" )
205216LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, 0 , " Builtin.emplace typed throws" )
217+ SUPPRESSIBLE_LANGUAGE_FEATURE(MemorySafetyAttributes, 458 , " @unsafe attribute" )
206218
207219// Swift 6
208220UPCOMING_FEATURE(ConciseMagicFile, 274 , 6 )
@@ -226,6 +238,14 @@ UPCOMING_FEATURE(ExistentialAny, 335, 7)
226238UPCOMING_FEATURE(InternalImportsByDefault, 409 , 7 )
227239UPCOMING_FEATURE(MemberImportVisibility, 444 , 7 )
228240
241+ // Optional language features / modes
242+
243+ // / Diagnose uses of language constructs and APIs that can violate memory
244+ // / safety.
245+ OPTIONAL_LANGUAGE_FEATURE(StrictMemorySafety, 458 , " Strict memory safety" )
246+
247+ // Experimental features
248+
229249EXPERIMENTAL_FEATURE(StaticAssert, false )
230250EXPERIMENTAL_FEATURE(NamedOpaqueTypes, false )
231251EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures, false )
@@ -396,12 +416,6 @@ EXPERIMENTAL_FEATURE(Extern, true)
396416// Enable trailing comma for comma-separated lists.
397417EXPERIMENTAL_FEATURE(TrailingComma, false )
398418
399- // / Allow the @unsafe attribute.
400- SUPPRESSIBLE_EXPERIMENTAL_FEATURE(AllowUnsafeAttribute, true )
401-
402- // / Warn on use of unsafe constructs.
403- EXPERIMENTAL_FEATURE(WarnUnsafe, true )
404-
405419// Import bounds safety and lifetime attributes from interop headers to
406420// generate Swift wrappers with safe pointer types.
407421EXPERIMENTAL_FEATURE(SafeInteropWrappers, false )
@@ -450,15 +464,20 @@ SUPPRESSIBLE_EXPERIMENTAL_FEATURE(CustomAvailability, true)
450464// / Be strict about the Sendable conformance of metatypes.
451465EXPERIMENTAL_FEATURE(StrictSendableMetatypes, true )
452466
467+
453468// / Allow public enumerations to be extensible by default
454469// / regardless of whether the module they are declared in
455470// / is resilient or not.
456471EXPERIMENTAL_FEATURE(ExtensibleEnums, true )
457472
473+ // / Allow isolated conformances.
474+ EXPERIMENTAL_FEATURE(IsolatedConformances, true )
475+
458476#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
459477#undef EXPERIMENTAL_FEATURE
460478#undef UPCOMING_FEATURE
461479#undef BASELINE_LANGUAGE_FEATURE
480+ #undef OPTIONAL_LANGUAGE_FEATURE
462481#undef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
463482#undef CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE
464483#undef SUPPRESSIBLE_EXPERIMENTAL_FEATURE
0 commit comments