title: How to resolve "type annotations required: cannot resolve _" when calling generic static method?
body: <p>I am trying to call a generic static method within a different static method, but I get a confusing error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error: type annotations required: cannot resolve `_: Config` [--explain E0283]
    --&gt; src/main.rs:15:38
     |&gt;
  15 |&gt;                     "json" =&gt; return Config::parse_json::&lt;T&gt;(source, datatype),
     |&gt;                                      ^^^^^^^^^^^^^^^^^^^^^^^
  note: required by `Config::parse_json`
  </code></pre>
  
  <p>When I ran <code>rustc --explain E0283</code>, the error message said:</p>
  
  <blockquote>
    <p>This error occurs when the compiler doesn't have enough information
    to unambiguously choose an implementation.</p>
  </blockquote>
  
  <p>Which is confusing as there is only one implementation of the function.</p>
  
  <pre><code>use rustc_serialize::json;
  use std::fs::File;
  use std::io::prelude::*;
  use std::path::PathBuf;
  use rustc_serialize;
  
  pub trait Config {
      fn get_config&lt;T: rustc_serialize::Decodable&gt;(source: PathBuf, datatype: T) -&gt; Option&lt;T&gt; {
          let extension = source.extension().unwrap();
          if let Some(extension) = extension.to_str() {
              match extension {
                  "json" =&gt; return Config::parse_json::&lt;T&gt;(source, datatype),
                  _ =&gt; panic!("Unable to parse the specfied extension."),
              }
          } else {
              panic!("No extension was found.");
          }
      }
  
      fn parse_json&lt;T: rustc_serialize::Decodable&gt;(source: PathBuf, datatype: T) -&gt; Option&lt;T&gt; {
          let mut file = File::open(source).unwrap();
          let mut contents = String::new();
          file.read_to_string(&amp;mut contents).unwrap();
          let decoded: T = json::decode(&amp;contents).unwrap();
          let option: Option&lt;T&gt; = Some(datatype);
          return option;
      }
  }
  </code></pre>