title: Why do I get the error "the trait `Foo` is not implemented for `&mut T`" even though T implements the trait?
body: <p>I have this source:</p>
  
  <pre><code>pub fn draw&lt;G, C&gt;(&amp;self, font: &amp;mut C, draw_state: &amp;DrawState, transform: Matrix2d, g: &amp;mut G)
  where
      C: CharacterCache,
      G: Graphics&lt;Texture = &lt;C as CharacterCache&gt;::Texture&gt;,
  {
      self.properties.draw(
          self.text.as_str(),
          &amp;mut font,
          &amp;draw_state,
          transform,
          g,
      );
  }
  </code></pre>
  
  <p>And the error</p>
  
  <pre class="lang-none prettyprint-override"><code>the trait bound `&amp;mut C: graphics::character::CharacterCache` is not satisfied 
  (the trait `graphics::character::CharacterCache` is not implemented for `&amp;mut C`) 
  </code></pre>
  
  <p>The only aspect of <code>C</code> that is defined is that it implements <code>CharacterCache</code>, yet the error says the opposite.</p>
  
  <p><code>DrawState</code>, <code>Matrix2d</code>, <code>CharacterCache</code> and its implementations, <code>Texture</code>, and self.properties (<code>Text</code>) are provided by the Piston 2d graphics library. There must be something about traits in general that I'm misunderstanding.</p>
  
  <p>The <code>Text::draw</code> function signature:</p>
  
  <pre><code>fn draw&lt;C, G&gt;(
      &amp;self,
      text: &amp;str,
      cache: &amp;mut C,
      draw_state: &amp;DrawState,
      transform: Matrix2d,
      g: &amp;mut G,
  ) where
      C: CharacterCache,
      G: Graphics&lt;Texture = C::Texture&gt;,
  </code></pre>