title: How do I disambiguate associated types?
body: <p>My current code looks like this:</p>
  
  <pre><code>pub trait A {}
  pub trait HasA {
      type A: A;
      fn gimme_a() -&gt; Self::A;
  }
  
  pub trait RichA: A {}
  pub trait RichHasA: HasA {
      type A: RichA;
      fn gimme_a() -&gt; Self::A;
      // ... more things go here ...
  }
  
  pub fn main() {}
  </code></pre>
  
  <p>My goal is to be able to use <code>RichHasA</code> as a <code>HasA</code>. The above code fails to compile with:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0221]: ambiguous associated type `A` in bounds of `Self`
    --&gt; src/main.rs:10:21
     |
  3  |     type A: A;
     |     ---------- ambiguous `A` from `HasA`
  ...
  9  |     type A: RichA;
     |     -------------- ambiguous `A` from `RichHasA`
  10 |     fn gimme_a() -&gt; Self::A;
     |                     ^^^^^^^ ambiguous associated type `A`
  </code></pre>
  
  <p>which makes sense. How can I  disambiguate associated types?</p>