Language features and language mode

Swift has added a lot of language features over the years, and some of these (all?) are enabled by default when using Swift 6 language mode.

However, I struggle to find a list of all these feature flags, and for which swift versions they are (a) available as an “upcoming” feature, and (b) which versions they are enabled by default.

I’ve found these:

.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableUpcomingFeature("ConciseMagicFile"),
.enableUpcomingFeature("DeprecateApplicationMain"),
.enableUpcomingFeature("DisableOutwardActorInference"),
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("ForwardTrailingClosures")
.enableUpcomingFeature("GlobalConcurrency"),
.enableUpcomingFeature("ImportObjcForwardDeclarations"),
.enableUpcomingFeature("InferSendableFromCaptures"),
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("IsolatedDefaultValues"),
.enableUpcomingFeature("StrictConcurrency"),

Can I remove all of these when switching to // swift-tools-version: 6.0?

As we at some point inevitably is moving towards the next language mode Swift 7, it will become harder and harder to search for these flags, and know which ones to apply and which ones to skip.

And it seems like maybe ExistentialAny is already being pushed for a later language mode?

Is there an authoritative list such as this somewhere?

Feature SE Available from Default from
ExistentialAny SE-0335 5.8 :warning: 7.0
BareSlashRegexLiterals SE-0354 5.7 6.0
... ... ... ...
2 Likes

I think this list might be what you’re after.

1 Like

@ole has a nice script to query the Features.def file from the repo. Not sure if it‘s public, though. @ole ?

I wrote 2 shell scripts named swift-list-features and swift-has-feature. They’re available here: swift-list-features: List Swift compiler upcoming and experimental feature flags. · swift-has-feature: Check if a given compiler knows a specific feature flag, and whether it's an upcoming or experimental flag. · GitHub

Example usage (after piping it to a tool for formatting the CSV output):

$ swift-list-features.sh 6.2 | xan view --all

Displaying 6 cols from 190 rows of <stdin>
┌─────┬──────────────┬──────────────────────┬───────────────┬───────────┬───────────────────┬──────────────────────┐
│ -   │ type         │ name                 │ language_mode │ se_number │ available_in_prod │ description          │
├─────┼──────────────┼──────────────────────┼───────────────┼───────────┼───────────────────┼──────────────────────┤
│ 0   │ <empty>      │ ABIAttributeSE0479   │ <empty>       │ SE-479    │ <empty>           │ @abi attribute on f… │
│ 1   │ <empty>      │ Actors               │ <empty>       │ <empty>   │ <empty>           │ actors               │
│ 2   │ <empty>      │ AlwaysInheritActorC… │ <empty>       │ SE-472    │ <empty>           │ @_inheritActorConte… │
│ 3   │ <empty>      │ AssociatedTypeAvail… │ <empty>       │ <empty>   │ <empty>           │ Availability on ass… │
│ 4   │ <empty>      │ AssociatedTypeImple… │ <empty>       │ <empty>   │ <empty>           │ @_implements on ass… │
│ 5   │ <empty>      │ AsyncAwait           │ <empty>       │ SE-296    │ <empty>           │ async/await          │
│ 6   │ <empty>      │ AsyncExecutionBehav… │ <empty>       │ <empty>   │ <empty>           │ @concurrent and non… │
│ 7   │ <empty>      │ AsyncSequenceFailure │ <empty>       │ <empty>   │ <empty>           │ Failure associated … │
│ 8   │ <empty>      │ AttachedMacros       │ <empty>       │ SE-389    │ <empty>           │ Attached macros      │
│ 9   │ <empty>      │ BitwiseCopyable      │ <empty>       │ SE-426    │ <empty>           │ BitwiseCopyable pro… │
│ 10  │ <empty>      │ BitwiseCopyable2     │ <empty>       │ SE-426    │ <empty>           │ BitwiseCopyable fea… │
│ 11  │ <empty>      │ BodyMacros           │ <empty>       │ SE-415    │ <empty>           │ Function body macros │
│ 12  │ <empty>      │ BorrowingSwitch      │ <empty>       │ SE-432    │ <empty>           │ Noncopyable type pa… │
│ 13  │ <empty>      │ BuiltinAddressOfRaw… │ <empty>       │ <empty>   │ <empty>           │ Builtin.addressOfRa… │
│ 14  │ <empty>      │ BuiltinAssumeAlignm… │ <empty>       │ <empty>   │ <empty>           │ Builtin.assumeAlign… │
│ 15  │ <empty>      │ BuiltinBuildComplex… │ <empty>       │ <empty>   │ <empty>           │ Executor-building f… │
│ 16  │ <empty>      │ BuiltinBuildExecutor │ <empty>       │ <empty>   │ <empty>           │ Executor-building b… │
│ 17  │ <empty>      │ BuiltinBuildMainExe… │ <empty>       │ <empty>   │ <empty>           │ MainActor executor … │
│ 18  │ <empty>      │ BuiltinBuildTaskExe… │ <empty>       │ <empty>   │ <empty>           │ TaskExecutor-buildi… │
│ 19  │ <empty>      │ BuiltinContinuation  │ <empty>       │ <empty>   │ <empty>           │ Continuation builti… │
│ 20  │ <empty>      │ BuiltinCreateAsyncD… │ <empty>       │ <empty>   │ <empty>           │ Task create in disc… │
│ 21  │ <empty>      │ BuiltinCreateAsyncD… │ <empty>       │ <empty>   │ <empty>           │ Task create in disc… │
│ 22  │ <empty>      │ BuiltinCreateAsyncT… │ <empty>       │ <empty>   │ <empty>           │ Task create in task… │
│ 23  │ <empty>      │ BuiltinCreateAsyncT… │ <empty>       │ <empty>   │ <empty>           │ Task create in task… │
│ 24  │ <empty>      │ BuiltinCreateAsyncT… │ <empty>       │ <empty>   │ <empty>           │ Task create with a … │
│ 25  │ <empty>      │ BuiltinCreateAsyncT… │ <empty>       │ <empty>   │ <empty>           │ Task create with ow… │
│ 26  │ <empty>      │ BuiltinCreateAsyncT… │ <empty>       │ <empty>   │ <empty>           │ Task create builtin… │
│ 27  │ <empty>      │ BuiltinCreateTask    │ <empty>       │ <empty>   │ <empty>           │ Builtin.createTask … │
│ 28  │ <empty>      │ BuiltinCreateTaskGr… │ <empty>       │ <empty>   │ <empty>           │ Builtin.createTaskG… │
│ 29  │ <empty>      │ BuiltinEmplaceTyped… │ <empty>       │ <empty>   │ <empty>           │ Builtin.emplace typ… │
│ 30  │ <empty>      │ BuiltinExecutor      │ <empty>       │ <empty>   │ <empty>           │ Builtin.Executor ty… │
│ 31  │ <empty>      │ BuiltinHopToActor    │ <empty>       │ <empty>   │ <empty>           │ Builtin.HopToActor   │
│ 32  │ <empty>      │ BuiltinIntLiteralAc… │ <empty>       │ SE-368    │ <empty>           │ Builtin.IntLiteral … │
│ 33  │ <empty>      │ BuiltinJob           │ <empty>       │ <empty>   │ <empty>           │ Builtin.Job type     │
│ 34  │ <empty>      │ BuiltinSelect        │ <empty>       │ <empty>   │ <empty>           │ Builtin.select       │
│ 35  │ <empty>      │ BuiltinStackAlloc    │ <empty>       │ <empty>   │ <empty>           │ Builtin.stackAlloc   │
│ 36  │ <empty>      │ BuiltinStoreRaw      │ <empty>       │ <empty>   │ <empty>           │ Builtin.storeRaw     │
│ 37  │ <empty>      │ BuiltinTaskGroupWit… │ <empty>       │ <empty>   │ <empty>           │ TaskGroup builtins   │
│ 38  │ <empty>      │ BuiltinTaskRunInline │ <empty>       │ <empty>   │ <empty>           │ Builtin.taskRunInli… │
│ 39  │ <empty>      │ BuiltinUnprotectedA… │ <empty>       │ <empty>   │ <empty>           │ Builtin.unprotected… │
│ 40  │ <empty>      │ BuiltinUnprotectedS… │ <empty>       │ <empty>   │ <empty>           │ Builtin.unprotected… │
│ 41  │ <empty>      │ ConcurrentFunctions  │ <empty>       │ <empty>   │ <empty>           │ @concurrent functio… │
│ 42  │ <empty>      │ ConformanceSuppress… │ <empty>       │ SE-426    │ <empty>           │ Suppressible inferr… │
│ 43  │ <empty>      │ EffectfulProp        │ <empty>       │ SE-310    │ <empty>           │ Effectful properties │
│ 44  │ <empty>      │ ExpressionMacroDefa… │ <empty>       │ SE-422    │ <empty>           │ Expression macro as… │
│ 45  │ <empty>      │ ExtensionMacroAttr   │ <empty>       │ <empty>   │ <empty>           │ @attached(extension) │
│ 46  │ <empty>      │ ExtensionMacros      │ <empty>       │ SE-402    │ <empty>           │ Extension macros     │
│ 47  │ <empty>      │ FreestandingExpress… │ <empty>       │ SE-382    │ <empty>           │ Expression macros    │
│ 48  │ <empty>      │ FreestandingMacros   │ <empty>       │ SE-397    │ <empty>           │ freestanding declar… │
│ 49  │ <empty>      │ GeneralizedIsSameMe… │ <empty>       │ SE-465    │ <empty>           │ Builtin.is_same_met… │
│ 50  │ <empty>      │ GlobalActors         │ <empty>       │ SE-316    │ <empty>           │ Global actors        │
│ 51  │ <empty>      │ ImplicitSelfCapture  │ <empty>       │ <empty>   │ <empty>           │ @_implicitSelfCaptu… │
│ 52  │ <empty>      │ InheritActorContext  │ <empty>       │ <empty>   │ <empty>           │ @_inheritActorConte… │
│ 53  │ <empty>      │ InlineArrayTypeSugar │ <empty>       │ SE-483    │ <empty>           │ Type sugar for Inli… │
│ 54  │ <empty>      │ IsolatedAny          │ <empty>       │ SE-431    │ <empty>           │ @isolated(any) func… │
│ 55  │ <empty>      │ IsolatedAny2         │ <empty>       │ SE-431    │ <empty>           │ @isolated(any) func… │
│ 56  │ <empty>      │ IsolatedConformances │ <empty>       │ SE-470    │ <empty>           │ Global-actor isolat… │
│ 57  │ <empty>      │ IsolatedDeinit       │ <empty>       │ SE-371    │ <empty>           │ isolated deinit      │
│ 58  │ <empty>      │ LexicalLifetimes     │ <empty>       │ <empty>   │ <empty>           │ @_eagerMove/@_noEag… │
│ 59  │ <empty>      │ Macros               │ <empty>       │ <empty>   │ <empty>           │ Macros               │
│ 60  │ <empty>      │ MarkerProtocol       │ <empty>       │ <empty>   │ <empty>           │ @_marker protocol    │
│ 61  │ <empty>      │ MemorySafetyAttribu… │ <empty>       │ SE-458    │ <empty>           │ @unsafe attribute    │
│ 62  │ <empty>      │ MoveOnly             │ <empty>       │ SE-390    │ <empty>           │ noncopyable types    │
│ 63  │ <empty>      │ MoveOnlyPartialCons… │ <empty>       │ SE-429    │ <empty>           │ Partial consumption… │
│ 64  │ <empty>      │ MoveOnlyResilientTy… │ <empty>       │ SE-390    │ <empty>           │ non-@frozen noncopy… │
│ 65  │ <empty>      │ NewCxxMethodSafetyH… │ <empty>       │ <empty>   │ <empty>           │ Only import C++ met… │
│ 66  │ <empty>      │ NoAsyncAvailability  │ <empty>       │ SE-340    │ <empty>           │ @available(*, noasy… │
│ 67  │ <empty>      │ NoncopyableGenerics  │ <empty>       │ SE-427    │ <empty>           │ Noncopyable generics │
│ 68  │ <empty>      │ NoncopyableGenerics2 │ <empty>       │ SE-427    │ <empty>           │ Noncopyable generic… │
│ 69  │ <empty>      │ NonescapableAccesso… │ <empty>       │ <empty>   │ <empty>           │ Support UnsafeMutab… │
│ 70  │ <empty>      │ NonescapableTypes    │ <empty>       │ SE-446    │ <empty>           │ Nonescapable types   │
│ 71  │ <empty>      │ NonexhaustiveAttrib… │ <empty>       │ SE-487    │ <empty>           │ Nonexhaustive Enums  │
│ 72  │ <empty>      │ ObjCImplementation   │ <empty>       │ SE-436    │ <empty>           │ @objc @implementati… │
│ 73  │ <empty>      │ OptionalIsolatedPar… │ <empty>       │ SE-420    │ <empty>           │ Optional isolated p… │
│ 74  │ <empty>      │ ParameterPacks       │ <empty>       │ SE-393    │ <empty>           │ Value and type para… │
│ 75  │ <empty>      │ PrimaryAssociatedTy… │ <empty>       │ SE-346    │ <empty>           │ Primary associated … │
│ 76  │ <empty>      │ RawIdentifiers       │ <empty>       │ SE-451    │ <empty>           │ Raw identifiers      │
│ 77  │ <empty>      │ RethrowsProtocol     │ <empty>       │ <empty>   │ <empty>           │ @rethrows protocol   │
│ 78  │ <empty>      │ RetroactiveAttribute │ <empty>       │ SE-364    │ <empty>           │ @retroactive         │
│ 79  │ <empty>      │ Sendable             │ <empty>       │ <empty>   │ <empty>           │ Sendable and @Senda… │
│ 80  │ <empty>      │ SendableCompletionH… │ <empty>       │ SE-463    │ <empty>           │ Objective-C complet… │
│ 81  │ <empty>      │ SendingArgsAndResul… │ <empty>       │ SE-430    │ <empty>           │ Sending arg and res… │
│ 82  │ <empty>      │ SpecializeAttribute… │ <empty>       │ <empty>   │ <empty>           │ @_specialize attrib… │
│ 83  │ <empty>      │ TypedThrows          │ <empty>       │ SE-413    │ <empty>           │ Typed throws         │
│ 84  │ <empty>      │ UnavailableFromAsync │ <empty>       │ <empty>   │ <empty>           │ @_unavailableFromAs… │
│ 85  │ <empty>      │ UnsafeInheritExecut… │ <empty>       │ <empty>   │ <empty>           │ @_unsafeInheritExec… │
│ 86  │ <empty>      │ ValueGenerics        │ <empty>       │ SE-452    │ <empty>           │ Value generics feat… │
│ 87  │ <empty>      │ ValueGenericsNameLo… │ <empty>       │ SE-452    │ <empty>           │ Value generics appe… │
│ 88  │ Experimental │ AccessLevelOnImport  │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 89  │ Experimental │ AdditiveArithmeticD… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 90  │ Experimental │ AddressableParamete… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 91  │ Experimental │ AddressableTypes     │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 92  │ Experimental │ AllowNonResilientAc… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 93  │ Experimental │ AllowRuntimeSymbolD… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 94  │ Experimental │ AssumeResilientCxxT… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 95  │ Experimental │ BuiltinMacros        │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 96  │ Experimental │ BuiltinModule        │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 97  │ Experimental │ CImplementation      │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 98  │ Experimental │ ClientBypassResilie… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 99  │ Experimental │ ClosureBodyMacro     │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 100 │ Experimental │ ClosureIsolation     │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 101 │ Experimental │ CodeItemMacros       │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 102 │ Experimental │ CompileTimeValues    │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 103 │ Experimental │ ConcurrencySyntaxSu… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 104 │ Experimental │ ConsumeSelfInDeinit  │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 105 │ Experimental │ CopyBlockOptimizati… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 106 │ Experimental │ CoroutineAccessors   │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 107 │ Experimental │ CoroutineAccessorsU… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 108 │ Experimental │ CustomAvailability   │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 109 │ Experimental │ DebugDescriptionMac… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 110 │ Experimental │ DefaultIsolationPer… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 111 │ Experimental │ DifferentiableProgr… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 112 │ Experimental │ DoExpressions        │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 113 │ Experimental │ Embedded             │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 114 │ Experimental │ Extern               │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 115 │ Experimental │ ExtractConstantsFro… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 116 │ Experimental │ FlowSensitiveConcur… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 117 │ Experimental │ ForwardModeDifferen… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 118 │ Experimental │ FullTypedThrows      │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 119 │ Experimental │ GenerateBindingsFor… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 120 │ Experimental │ GroupActorErrors     │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 121 │ Experimental │ ImplicitLastExprRes… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 122 │ Experimental │ ImplicitSome         │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 123 │ Experimental │ ImportNonPublicCxxM… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 124 │ Experimental │ ImportSymbolicCXXDe… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 125 │ Experimental │ InoutLifetimeDepend… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 126 │ Experimental │ KeyPathWithMethodMe… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 127 │ Experimental │ LayoutPrespecializa… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 128 │ Experimental │ LayoutStringValueWi… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 129 │ Experimental │ LayoutStringValueWi… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 130 │ Experimental │ LazyImmediate        │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 131 │ Experimental │ LifetimeDependence   │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 132 │ Experimental │ LifetimeDependenceM… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 133 │ Experimental │ Lifetimes            │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 134 │ Experimental │ MacrosOnImports      │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 135 │ Experimental │ MoveOnlyClasses      │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 136 │ Experimental │ MoveOnlyEnumDeinits  │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 137 │ Experimental │ MoveOnlyPartialRein… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 138 │ Experimental │ MoveOnlyTuples       │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 139 │ Experimental │ NamedOpaqueTypes     │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 140 │ Experimental │ NoExplicitNonIsolat… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 141 │ Experimental │ NoImplicitCopy       │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 142 │ Experimental │ ObjCImplementationW… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 143 │ Experimental │ OldOwnershipOperato… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 144 │ Experimental │ OpaqueTypeErasure    │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 145 │ Experimental │ PackageCMO           │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 146 │ Experimental │ ParserASTGen         │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 147 │ Experimental │ ParserRoundTrip      │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 148 │ Experimental │ ParserValidation     │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 149 │ Experimental │ PlaygroundExtendedC… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 150 │ Experimental │ PreambleMacros       │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 151 │ Experimental │ RawLayout            │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 152 │ Experimental │ ReferenceBindings    │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 153 │ Experimental │ ReinitializeConsume… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 154 │ Experimental │ SafeInteropWrappers  │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 155 │ Experimental │ SameElementRequirem… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 156 │ Experimental │ SE427NoInferenceOnE… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 157 │ Experimental │ Sensitive            │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 158 │ Experimental │ StaticAssert         │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 159 │ Experimental │ StaticExclusiveOnly  │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 160 │ Experimental │ StructLetDestructur… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 161 │ Experimental │ SuppressCXXForeignR… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 162 │ Experimental │ SuppressedAssociate… │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 163 │ Experimental │ SymbolLinkageMarkers │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 164 │ Experimental │ ThenStatements       │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 165 │ Experimental │ TrailingComma        │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 166 │ Experimental │ TupleConformances    │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 167 │ Experimental │ UnqualifiedLookupVa… │ <empty>       │ <empty>   │ false             │ <empty>              │
│ 168 │ Experimental │ Volatile             │ <empty>       │ <empty>   │ true              │ <empty>              │
│ 169 │ Optional     │ StrictMemorySafety   │ <empty>       │ SE-458    │ <empty>           │ \Strict memory safe… │
│ 170 │ Upcoming     │ BareSlashRegexLiter… │ 6             │ SE-354    │ <empty>           │ <empty>              │
│ 171 │ Upcoming     │ ConciseMagicFile     │ 6             │ SE-274    │ <empty>           │ <empty>              │
│ 172 │ Upcoming     │ DeprecateApplicatio… │ 6             │ SE-383    │ <empty>           │ <empty>              │
│ 173 │ Upcoming     │ DisableOutwardActor… │ 6             │ SE-401    │ <empty>           │ <empty>              │
│ 174 │ Upcoming     │ DynamicActorIsolati… │ 6             │ SE-423    │ <empty>           │ <empty>              │
│ 175 │ Upcoming     │ ExistentialAny       │ 7             │ SE-335    │ <empty>           │ <empty>              │
│ 176 │ Upcoming     │ ForwardTrailingClos… │ 6             │ SE-286    │ <empty>           │ <empty>              │
│ 177 │ Upcoming     │ GlobalActorIsolated… │ 6             │ SE-0434   │ <empty>           │ <empty>              │
│ 178 │ Upcoming     │ GlobalConcurrency    │ 6             │ SE-412    │ <empty>           │ <empty>              │
│ 179 │ Upcoming     │ ImplicitOpenExisten… │ 6             │ SE-352    │ <empty>           │ <empty>              │
│ 180 │ Upcoming     │ ImportObjcForwardDe… │ 6             │ SE-384    │ <empty>           │ <empty>              │
│ 181 │ Upcoming     │ InferIsolatedConfor… │ 7             │ SE-470    │ <empty>           │ <empty>              │
│ 182 │ Upcoming     │ InferSendableFromCa… │ 6             │ SE-418    │ <empty>           │ <empty>              │
│ 183 │ Upcoming     │ InternalImportsByDe… │ 7             │ SE-409    │ <empty>           │ <empty>              │
│ 184 │ Upcoming     │ IsolatedDefaultValu… │ 6             │ SE-411    │ <empty>           │ <empty>              │
│ 185 │ Upcoming     │ MemberImportVisibil… │ 7             │ SE-444    │ <empty>           │ <empty>              │
│ 186 │ Upcoming     │ NonfrozenEnumExhaus… │ 6             │ SE-192    │ <empty>           │ <empty>              │
│ 187 │ Upcoming     │ NonisolatedNonsendi… │ 7             │ SE-461    │ <empty>           │ <empty>              │
│ 188 │ Upcoming     │ RegionBasedIsolation │ 6             │ SE-414    │ <empty>           │ <empty>              │
│ 189 │ Upcoming     │ StrictConcurrency    │ 6             │ SE-0337   │ <empty>           │ <empty>              │
├─────┼──────────────┼──────────────────────┼───────────────┼───────────┼───────────────────┼──────────────────────┤
│ -   │ type         │ name                 │ language_mode │ se_number │ available_in_prod │ description          │
└─────┴──────────────┴──────────────────────┴───────────────┴───────────┴───────────────────┴──────────────────────┘
Displaying 6 cols from 190 rows of <stdin>

As @nikolai.ruhe said, this downloads and parses the Features.def file from the repo. You can specify a branch name to get the features for a specific version. The list also includes experimental features etc., but it's easy enough to filter for upcoming features only.

7 Likes

Thanks for the tool, @ole! That's certainly useful!

Also, on a tangent: Is there a way to turn on some of these feature per-file?

Enabling e.g. StrictConcurrency is a daunting endeavor for a large code base. Even when done one module at a time. And doing so today, for me, simply produces too many errors and warnings to handle. However, I wouldn't want to accidentally write new code that wasn't "strict"-conformant, simply because the feature isn't enabled yet.

I really need a strategy to make our code swift 6-ready, in a piecemeal fashion, and I'm struggling to see the light at the end of the tunnel.

1 Like

You'll want to follow Apple's migration guide, but also enable most of the upcoming features that help with compiler intelligence, like inferring Sendable for closures and KeyPaths (I'll see if I can find my post on the subject). Essentially, enable the features, then work your way through targeted and complete concurrency checking, before moving to Swift 6 (which will likely have additional issues).

FWIW, the compiler actually supports a -print-supported-featuresflag in the Swift 6.2 toolchain:

> xcrun swiftc -print-supported-features
{
  "features": {
    "optional": [
      { "name": "StrictMemorySafety", "migratable": true, "categories": ["StrictMemorySafety"], "flag_name": "-strict-memory-safety" }
    ],
    "upcoming": [
      { "name": "ConciseMagicFile", "enabled_in": "6" },
      { "name": "ForwardTrailingClosures", "enabled_in": "6" },
      { "name": "StrictConcurrency", "enabled_in": "6" },
      { "name": "BareSlashRegexLiterals", "enabled_in": "6" },
      { "name": "DeprecateApplicationMain", "enabled_in": "6" },
      { "name": "ImportObjcForwardDeclarations", "enabled_in": "6" },
      { "name": "DisableOutwardActorInference", "enabled_in": "6" },
      { "name": "IsolatedDefaultValues", "enabled_in": "6" },
      { "name": "GlobalConcurrency", "enabled_in": "6" },
      { "name": "InferSendableFromCaptures", "enabled_in": "6" },
      { "name": "ImplicitOpenExistentials", "enabled_in": "6" },
      { "name": "RegionBasedIsolation", "enabled_in": "6" },
      { "name": "DynamicActorIsolation", "enabled_in": "6" },
      { "name": "NonfrozenEnumExhaustivity", "enabled_in": "6" },
      { "name": "GlobalActorIsolatedTypesUsability", "enabled_in": "6" },
      { "name": "ExistentialAny", "migratable": true, "categories": ["ExistentialAny"], "enabled_in": "7" },
      { "name": "InternalImportsByDefault", "enabled_in": "7" },
      { "name": "MemberImportVisibility", "migratable": true, "categories": ["MemberImportVisibility"], "enabled_in": "7" },
      { "name": "InferIsolatedConformances", "migratable": true, "categories": ["IsolatedConformances"], "enabled_in": "7" },
      { "name": "NonisolatedNonsendingByDefault", "migratable": true, "categories": ["NonisolatedNonsendingByDefault"], "enabled_in": "7" }
    ],
    "experimental": [
...

Note that the output included in the experimental section is buggy in Swift 6.2 but that has been fixed on main.

6 Likes