title: E0308 mismatched types with simple generic function
body: <p>I'm new to Rust and I'm trying to write my own simple generic function.</p>
  
  <pre><code>fn templ_sum&lt;T&gt;(x : T, y : T) -&gt; T
      where T : std::ops::Add
  {
      let res : T = x + y;
      res
  }
  
  fn main()
  {
      let x : f32 = 1.0;
      let y : f32 = 2.0;
      let z = templ_sum(x, y);
      println!("{}", z);
  }
  </code></pre>
  
  <p>But compiling failed with message</p>
  
  <blockquote>
    <p>error: mismatched types:  expected <code>T</code>,
        found <code>&lt;T as core::ops::Add&gt;::Output</code> (expected type parameter,
        found associated type) [E0308] main.rs:12     let res : T = x + y;</p>
  </blockquote>
  
  <p>I am confused a little. Can anyone explain to me what I'm doing wrong?</p>
  
  <p>rustc --version: rustc 1.2.0 (082e47636 2015-08-03)</p>