@@ -825,10 +825,14 @@ extension MutableSpan where Element: ~Copyable {
825825 @_alwaysEmitIntoClient
826826 @lifetime ( & self )
827827 mutating public func extracting( first maxLength: Int ) -> Self {
828+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
828829 _precondition ( maxLength >= 0 , " Can't have a prefix of negative length " )
829830 let newCount = min ( maxLength, count)
830831 let newSpan = unsafe Self( _unchecked: _pointer, count: newCount)
831832 return unsafe _override Lifetime ( newSpan, mutating: & self )
833+ #else
834+ fatalError ( " Unsupported compiler " )
835+ #endif
832836 }
833837
834838 /// Returns a span over all but the given number of trailing elements.
@@ -848,11 +852,15 @@ extension MutableSpan where Element: ~Copyable {
848852 @_alwaysEmitIntoClient
849853 @lifetime ( & self )
850854 mutating public func extracting( droppingLast k: Int ) -> Self {
855+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
851856 _precondition ( k >= 0 , " Can't drop a negative number of elements " )
852857 let droppedCount = min ( k, count)
853858 let newCount = count &- droppedCount
854859 let newSpan = unsafe Self( _unchecked: _pointer, count: newCount)
855860 return unsafe _override Lifetime ( newSpan, mutating: & self )
861+ #else
862+ fatalError ( " Unsupported compiler " )
863+ #endif
856864 }
857865
858866 /// Returns a span containing the final elements of the span,
@@ -873,12 +881,16 @@ extension MutableSpan where Element: ~Copyable {
873881 @_alwaysEmitIntoClient
874882 @lifetime ( & self )
875883 mutating public func extracting( last maxLength: Int ) -> Self {
884+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
876885 _precondition ( maxLength >= 0 , " Can't have a suffix of negative length " )
877886 let newCount = min ( maxLength, count)
878887 let offset = ( count &- newCount) * MemoryLayout< Element> . stride
879888 let newStart = unsafe _pointer? . advanced ( by: offset)
880889 let newSpan = unsafe Self( _unchecked: newStart, count: newCount)
881890 return unsafe _override Lifetime ( newSpan, mutating: & self )
891+ #else
892+ fatalError ( " Unsupported compiler " )
893+ #endif
882894 }
883895
884896 /// Returns a span over all but the given number of initial elements.
@@ -898,12 +910,16 @@ extension MutableSpan where Element: ~Copyable {
898910 @_alwaysEmitIntoClient
899911 @lifetime ( & self )
900912 mutating public func extracting( droppingFirst k: Int ) -> Self {
913+ #if compiler(>=5.3) && hasFeature(SendableCompletionHandlers)
901914 _precondition ( k >= 0 , " Can't drop a negative number of elements " )
902915 let droppedCount = min ( k, count)
903916 let offset = droppedCount * MemoryLayout< Element> . stride
904917 let newStart = unsafe _pointer? . advanced ( by: offset)
905918 let newCount = count &- droppedCount
906919 let newSpan = unsafe Self( _unchecked: newStart, count: newCount)
907920 return unsafe _override Lifetime ( newSpan, mutating: & self )
921+ #else
922+ fatalError ( " Unsupported compiler " )
923+ #endif
908924 }
909925}
0 commit comments