title: How does Swift infer Sequence requirements when Self implements IteratorProtocol?
body: <p>I'm reading the Sequence documentation and in an example that they use (see below) the requirements for Sequence are inferred. My question is how is it inferred. I understand how inferencing works in simpler cases but in this example I cannot understand how Swift infers things.</p>
  <p>I see that Sequence's makeIterator method has a default implementation but I don't understand how the return value is inferred here.</p>
  <p><strong>Example</strong></p>
  <pre><code>struct Countdown: Sequence, IteratorProtocol {
  
      var count: Int
  
      mutating func next() -&gt; Int? {
          if count == 0 {
              return nil
          } else {
              defer { count -= 1 }
              return count
          }
      }
  }
  </code></pre>
  <hr />
  <p><strong>Reference for types mentioned above</strong></p>
  <pre><code>IteratorProtocol {
  
     func next() -&gt; Self.Element?
  
     associatedtype Iterator
  
     associatedtype Element
  }
  </code></pre>
  <pre><code>Sequence {
  
     func makeIterator() -&gt; Self.Iterator
  
     associatedtype Iterator
  
     associatedtype Element
  
  }
  </code></pre>