   /// Because of buffering, it is impossible to find the corresponding position
   /// in the iterator for a given returned `UnicodeScalar` or an error.
   ///
-  /// - Parameter next: A generator of code units to be decoded.  Repeated
+  /// - Parameter next: An iterator of code units to be decoded.  Repeated
   ///   calls to this method on the same instance should always pass the same
-  ///   generator and the generator or copies thereof should not be used for
+  ///   iterator and the iterator or copies thereof should not be used for
   ///   anything else between calls.  Failing to do so will yield unspecified
   ///   results.
   public mutating func decode<

  /// The number of bits in `_decodeBuffer` that are current filled.
  var _bitsInBuffer: UInt8 = 0

  /// Whether we have exhausted the generator.  Note that this doesn't mean
  /// we are done decoding, as there might still be bytes left in the buffer.
  var _didExhaustGenerator: Bool = false

  /// Start or continue decoding a UTF-8 sequence.
  ///
  /// In order to decode a code unit sequence completely, this function should
  /// be called repeatedly until it returns `UnicodeDecodingResult.emptyInput`.
  /// Checking that the generator was exhausted is not sufficient.  The decoder
  /// can have an internal buffer that is pre-filled with data from the input
  /// generator.
  ///
  /// Because of buffering, it is impossible to find the corresponding position
  /// in the generator for a given returned `UnicodeScalar` or an error.
  ///
  /// - Parameter next: A generator of code units to be decoded.  Repeated
  ///   calls to this method on the same instance should always pass the same
  ///   generator and the generator or copies thereof should not be used for
  ///   anything else between calls.  Failing to do so will yield unspecified
  ///   results.
  public mutating func decode<
    I : IteratorProtocol where I.Element == CodeUnit
  >(next: inout I) -> UnicodeDecodingResult {

      refillBuffer: if !_didExhaustGenerator {
        // Bufferless ASCII fastpath.
        if _fastPath(_bitsInBuffer == 0) {
          if let codeUnit = next.next() {

  /// Because of buffering, it is impossible to find the corresponding position
  /// in the iterator for a given returned `UnicodeScalar` or an error.
  ///
  /// - Parameter next: An iterator of code units to be decoded.  Repeated
  ///   calls to this method on the same instance should always pass the same
  ///   iterator and the iterator or copies thereof should not be used for
  ///   anything else between calls.  Failing to do so will yield unspecified
  ///   results.
  public mutating func decode<
