@@ -825,10 +825,14 @@ extension MutableSpan where Element: ~Copyable {
825
825
@_alwaysEmitIntoClient
826
826
@lifetime ( & self )
827
827
mutating public func extracting( first maxLength: Int ) -> Self {
828
+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
828
829
_precondition ( maxLength >= 0 , " Can't have a prefix of negative length " )
829
830
let newCount = min ( maxLength, count)
830
831
let newSpan = unsafe Self( _unchecked: _pointer, count: newCount)
831
832
return unsafe _override Lifetime ( newSpan, mutating: & self )
833
+ #else
834
+ fatalError ( " Unsupported compiler " )
835
+ #endif
832
836
}
833
837
834
838
/// Returns a span over all but the given number of trailing elements.
@@ -848,11 +852,15 @@ extension MutableSpan where Element: ~Copyable {
848
852
@_alwaysEmitIntoClient
849
853
@lifetime ( & self )
850
854
mutating public func extracting( droppingLast k: Int ) -> Self {
855
+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
851
856
_precondition ( k >= 0 , " Can't drop a negative number of elements " )
852
857
let droppedCount = min ( k, count)
853
858
let newCount = count &- droppedCount
854
859
let newSpan = unsafe Self( _unchecked: _pointer, count: newCount)
855
860
return unsafe _override Lifetime ( newSpan, mutating: & self )
861
+ #else
862
+ fatalError ( " Unsupported compiler " )
863
+ #endif
856
864
}
857
865
858
866
/// Returns a span containing the final elements of the span,
@@ -873,12 +881,16 @@ extension MutableSpan where Element: ~Copyable {
873
881
@_alwaysEmitIntoClient
874
882
@lifetime ( & self )
875
883
mutating public func extracting( last maxLength: Int ) -> Self {
884
+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
876
885
_precondition ( maxLength >= 0 , " Can't have a suffix of negative length " )
877
886
let newCount = min ( maxLength, count)
878
887
let offset = ( count &- newCount) * MemoryLayout< Element> . stride
879
888
let newStart = unsafe _pointer? . advanced ( by: offset)
880
889
let newSpan = unsafe Self( _unchecked: newStart, count: newCount)
881
890
return unsafe _override Lifetime ( newSpan, mutating: & self )
891
+ #else
892
+ fatalError ( " Unsupported compiler " )
893
+ #endif
882
894
}
883
895
884
896
/// Returns a span over all but the given number of initial elements.
@@ -898,12 +910,16 @@ extension MutableSpan where Element: ~Copyable {
898
910
@_alwaysEmitIntoClient
899
911
@lifetime ( & self )
900
912
mutating public func extracting( droppingFirst k: Int ) -> Self {
913
+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
901
914
_precondition ( k >= 0 , " Can't drop a negative number of elements " )
902
915
let droppedCount = min ( k, count)
903
916
let offset = droppedCount * MemoryLayout< Element> . stride
904
917
let newStart = unsafe _pointer? . advanced ( by: offset)
905
918
let newCount = count &- droppedCount
906
919
let newSpan = unsafe Self( _unchecked: newStart, count: newCount)
907
920
return unsafe _override Lifetime ( newSpan, mutating: & self )
921
+ #else
922
+ fatalError ( " Unsupported compiler " )
923
+ #endif
908
924
}
909
925
}
0 commit comments