[6.2] Add Feature: NonescapableAccessorOnTrivial #82381
Merged
+75
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To guard the new UnsafeMutablePointer.mutableSpan APIs.
This allows older compilers to ignore the new APIs. Otherwise, the type checker
will crash on the synthesized _read accessor for a non-Escapable type:
I don't know why the _read is synthesized in these cases, but apparently it's
always been that way.
Fixes: rdar://153773093 ([nonescapable] add a compiler feature to guard
~Escapable accessors when self is trivial)
(cherry picked from commit ae31edc)
The UnsafeMutablePointer.mutableSpan API was reverted here, pending this fix:
#82351
--- CCC ---
Explanation: Add a compile feature to guard the new UnsafeMutablePointer.mutableSpan APIs.
This allows older compilers to ignore the new APIs. Otherwise, the type checker
will crash on the synthesized _read accessor for a non-Escapable type:
Scope: Only affects users of the supported experiment Lifetimes feature.
Radar/SR Issue: rdar://153773093 ([nonescapable] add a compiler feature to guard ~Escapable accessors when self is trivial)
main PR: #82380
Risk: Low
Testing: Added a unit test, manually inspected Swift.swiftinterface, rebuilt the Swift module with an old compiler.
Reviewer: Slava Pestov