     i = index
   }
 
-  @_inlineable // FIXME(sil-serialize-all)
-  // FIXME(conditional-conformances): this is a copy of a default
-  // implementation. Can be removed once teh default one allows negative
-  // results to be returned.
-  public func distance(from start: Index, to end: Index) -> Int {
-    var _start: Index
-    let _end: Index
-    let step: Int
-    if start > end {
-      _start = end
-      _end = start
-      step = -1
-    }
-    else {
-      _start = start
-      _end = end
-      step = 1
-    }
-    var count = 0
-    while _start != _end {
-      count += step
-      formIndex(after: &_start)
-    }
-    return count
-  }
-
   @inline(__always)
   @_inlineable // FIXME(sil-serialize-all)
   @_versioned // FIXME(sil-serialize-all)

  ) -> Index? {
    var i = i
    let step = n.signum()
    for _ in 0 ..< abs(numericCast(n)) {
      if i == limit {
        return nil

      } while i != _base.endIndex && !_predicate(_base[i])
  }

  @inline(__always)
  @_inlineable // FIXME(sil-serialize-all)
  @_versioned // FIXME(sil-serialize-all)
  internal func _ensureBidirectional(step: Int) {
    // FIXME: This seems to be the best way of checking whether _base is
    // forward only without adding an extra protocol requirement.
    // index(_:offsetBy:limitedBy:) is chosen becuase it is supposed to return
    // nil when the resulting index lands outside the collection boundaries,
    // and therefore likely does not trap in these cases.
    if step < 0 {
      _ = _base.index(
        _base.endIndex, offsetBy: step, limitedBy: _base.startIndex)
    }
  }

  @_inlineable // FIXME(sil-serialize-all)
  public func index(_ i: Index, offsetBy n: Int) -> Index {
    var i = i
    let step = n.signum()
    // The following line makes sure that index(_:offsetBy:) is invoked on the
    // _base at least once, to trigger a _precondition in forward only
    // collections.
    _ensureBidirectional(step: step)
    for _ in 0 ..< abs(numericCast(n)) {
      _advanceIndex(&i, step: step)
    }
