Experimental feature 'MoveOnly' cannot be enabled in a production compiler

when i try to use the SPM’s enableExperimentalFeature(_:) API to enable @_moveOnly, with a 5.8 toolchain:

swiftSettings:
[
    .enableExperimentalFeature("MoveOnly"),
]

i get:

<unknown>:0: error: experimental feature 'MoveOnly' cannot be enabled in a production compiler
error: emit-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: experimental feature 'MoveOnly' cannot be enabled in a production compiler
<unknown>:0: error: experimental feature 'MoveOnly' cannot be enabled in a production compiler

does this mean enableExperimentalFeature only works on the 5.9 nightlies?

i can, for some reason, pass the flag at a lower level with:

[
    .unsafeFlags(["-Xfrontend", "-enable-experimental-move-only"]),
]

and build the target successfully, so this seems to be some kind of limitation of SPM instead of the 5.8 toolchain. (of course, unsafeFlags makes the package unconsumable, but one problem at a time…)

3 Likes

How did you solve this issue
I have a similar one which is
:0: experimental feature 'OpaqueTypeErasure' cannot be enabled in a production compiler