       target.append(contentsOf: source[start..<index])
     }
 
+    var result = Self()
     do {
+      var enumeratedRemoves = 0
+      var enumeratedInserts = 0
+      var enumeratedOriginals = 0
+      var currentIndex = self.startIndex
       try difference._fastEnumeratedApply { change in
         switch change {
         case .remove(offset: let offset, element: _, associatedWith: _):

        }
        _internalInvariant(enumeratedOriginals <= self.count)
      }
      let origCount = self.count - enumeratedOriginals
      try append(into: &result, contentsOf: self, from: &currentIndex, count: origCount)
      _internalInvariant(enumeratedOriginals + origCount == self.count)
    } catch {
      return nil
    }

    _internalInvariant(currentIndex == self.endIndex)
    _internalInvariant(result.count == self.count + enumeratedInserts - enumeratedRemoves)
    return result
  }
}

  ///   number of changes contained by the parameter.
  @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  public func applying(_ difference: CollectionDifference<Element>) -> Self? {

    func append(
      into target: inout Self,
