Skip to content

Commit c35b567

Browse files
authored
Temporary removal of RangeSet/DiscontiguousSlice (#35076)
1 parent 8dec996 commit c35b567

File tree

11 files changed

+11
-1581
lines changed

11 files changed

+11
-1581
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,11 @@ set(SWIFTLIB_SOURCES
209209
Availability.swift
210210
CollectionDifference.swift
211211
CollectionOfOne.swift
212-
DiscontiguousSlice.swift
213212
Diffing.swift
214213
FloatingPointRandom.swift
215214
Mirror.swift
216215
PlaygroundDisplay.swift
217216
CommandLine.swift
218-
RangeSet.swift
219-
RangeSetStorage.swift
220217
SliceBuffer.swift
221218
SIMDVector.swift
222219
UnfoldSequence.swift

stdlib/public/core/CollectionAlgorithms.swift

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -209,70 +209,6 @@ extension BidirectionalCollection where Element: Equatable {
209209
}
210210
}
211211

212-
//===----------------------------------------------------------------------===//
213-
// subranges(where:) / subranges(of:)
214-
//===----------------------------------------------------------------------===//
215-
216-
extension Collection {
217-
/// Returns the indices of all the elements that match the given predicate.
218-
///
219-
/// For example, you can use this method to find all the places that a
220-
/// vowel occurs in a string.
221-
///
222-
/// let str = "Fresh cheese in a breeze"
223-
/// let vowels: Set<Character> = ["a", "e", "i", "o", "u"]
224-
/// let allTheVowels = str.subranges(where: { vowels.contains($0) })
225-
/// // str[allTheVowels].count == 9
226-
///
227-
/// - Parameter predicate: A closure that takes an element as its argument
228-
/// and returns a Boolean value that indicates whether the passed element
229-
/// represents a match.
230-
/// - Returns: A set of the indices of the elements for which `predicate`
231-
/// returns `true`.
232-
///
233-
/// - Complexity: O(*n*), where *n* is the length of the collection.
234-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
235-
public func subranges(where predicate: (Element) throws -> Bool) rethrows
236-
-> RangeSet<Index>
237-
{
238-
if isEmpty { return RangeSet() }
239-
240-
var result = RangeSet<Index>()
241-
var i = startIndex
242-
while i != endIndex {
243-
let next = index(after: i)
244-
if try predicate(self[i]) {
245-
result._append(i..<next)
246-
}
247-
i = next
248-
}
249-
250-
return result
251-
}
252-
}
253-
254-
extension Collection where Element: Equatable {
255-
/// Returns the indices of all the elements that are equal to the given
256-
/// element.
257-
///
258-
/// For example, you can use this method to find all the places that a
259-
/// particular letter occurs in a string.
260-
///
261-
/// let str = "Fresh cheese in a breeze"
262-
/// let allTheEs = str.subranges(of: "e")
263-
/// // str[allTheEs].count == 7
264-
///
265-
/// - Parameter element: An element to look for in the collection.
266-
/// - Returns: A set of the indices of the elements that are equal to
267-
/// `element`.
268-
///
269-
/// - Complexity: O(*n*), where *n* is the length of the collection.
270-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
271-
public func subranges(of element: Element) -> RangeSet<Index> {
272-
subranges(where: { $0 == element })
273-
}
274-
}
275-
276212
//===----------------------------------------------------------------------===//
277213
// partition(by:)
278214
//===----------------------------------------------------------------------===//

stdlib/public/core/DiscontiguousSlice.swift

Lines changed: 0 additions & 222 deletions
This file was deleted.

stdlib/public/core/GroupInfo.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@
7171
"Sort.swift",
7272
"Range.swift",
7373
"ClosedRange.swift",
74-
"RangeSet.swift",
75-
"RangeSetStorage.swift",
7674
"CollectionOfOne.swift",
7775
"BridgingBuffer.swift",
7876
"Sequence.swift",
@@ -99,7 +97,6 @@
9997
"Filter.swift",
10098
"Reverse.swift",
10199
"Slice.swift",
102-
"DiscontiguousSlice.swift",
103100
"DropWhile.swift",
104101
"PrefixWhile.swift",
105102
"LazyCollection.swift",

stdlib/public/core/MutableCollection.swift

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -267,48 +267,6 @@ extension MutableCollection {
267267
}
268268
}
269269

270-
//===----------------------------------------------------------------------===//
271-
// moveSubranges(_:to:)
272-
//===----------------------------------------------------------------------===//
273-
274-
extension MutableCollection {
275-
/// Moves the elements in the given subranges to just before the element at
276-
/// the specified index.
277-
///
278-
/// This example finds all the uppercase letters in the array and then
279-
/// moves them to between `"i"` and `"j"`.
280-
///
281-
/// var letters = Array("ABCdeFGhijkLMNOp")
282-
/// let uppercaseRanges = letters.subranges(where: { $0.isUppercase })
283-
/// let rangeOfUppercase = letters.moveSubranges(uppercaseRanges, to: 10)
284-
/// // String(letters) == "dehiABCFGLMNOjkp"
285-
/// // rangeOfUppercase == 4..<13
286-
///
287-
/// - Parameters:
288-
/// - subranges: The subranges of the elements to move.
289-
/// - insertionPoint: The index to use as the destination of the elements.
290-
/// - Returns: The new bounds of the moved elements.
291-
///
292-
/// - Complexity: O(*n* log *n*) where *n* is the length of the collection.
293-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
294-
@discardableResult
295-
public mutating func moveSubranges(
296-
_ subranges: RangeSet<Index>, to insertionPoint: Index
297-
) -> Range<Index> {
298-
let lowerCount = distance(from: startIndex, to: insertionPoint)
299-
let upperCount = distance(from: insertionPoint, to: endIndex)
300-
let start = _indexedStablePartition(
301-
count: lowerCount,
302-
range: startIndex..<insertionPoint,
303-
by: { subranges.contains($0) })
304-
let end = _indexedStablePartition(
305-
count: upperCount,
306-
range: insertionPoint..<endIndex,
307-
by: { !subranges.contains($0) })
308-
return start..<end
309-
}
310-
}
311-
312270
//===----------------------------------------------------------------------===//
313271
// _rotate(in:shiftingToStart:)
314272
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)