title: How to check whether a generic type implements a generic trait?
body: <p>I want to check whether a type implements a trait without creating an object. But it doesn't compile. See the comments in code . So what should I do to get my goal?</p>
  
  <pre><code>#![feature(specialization)]
  
  struct T1;
  struct T2;
  
  trait A {}
  
  impl A for T1 {}
  
  trait Get_Static&lt;TraitType&gt; {
      fn has_trait() -&gt; bool ;
  }
  default impl&lt;TraitType, T&gt; Get_Static&lt;TraitType&gt; for T
  {
      fn has_trait() -&gt; bool { false }
  }
  impl&lt;TraitType, T&gt; Get_Static&lt;TraitType&gt; for T where T:TraitType
  {
      fn has_trait() -&gt; bool { true }
  }//Compiler complains TraitType is not a trait but type parameter
  
  fn main() {
      if &lt;T1 as Get_Static&gt;::&lt;A&gt;::has_trait() {println!("{}", true)} else {println!("{}", false)}
      if &lt;T2 as Get_Static&gt;::&lt;A&gt;::has_trait() {println!("{}", true)} else {println!("{}", false)}
  //This is surely wrong syntax but I don't know the right syntax
  }
  </code></pre>