title: proc_macro_attribute seems to not play nicely with struct impls and traits
body: <p>I'm trying to get a procedural macro to print out information about variables in my function inputs. When I test the macro in a separate crate, I get an error from the compiler that I'm not implementing the trait functions even though the trait functions are clearly implemented.</p>
  
  <p>Please ignore that the attr isn't returning anything yet; I'm building it together but ran into this issue first.</p>
  
  <p>The procedural macro definition:</p>
  
  <pre><code>extern crate proc_macro;
  use self::proc_macro::TokenStream;
  use syn::{parse_macro_input, ItemFn};
  
  #[proc_macro_attribute]
  pub fn my_macro(attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -&gt; proc_macro::TokenStream {
      println!("item: \"{}\"", item.to_string());
      let func = parse_macro_input!(item as ItemFn);
      let input_funcs = func.sig.inputs
              .iter()
              .map(|item| println!("{:?}", try_me(item)));
  
      //input_funcs
      attr
  }
  
  fn try_me(arg: &amp;syn::FnArg) -&gt; String {
      match arg {
          syn::FnArg::Receiver(_r) =&gt; "is receiver".to_string(),
          syn::FnArg::Typed(_p) =&gt; "is pattern type".to_string()
      }
  }
  </code></pre>
  
  <p>the testing crate:</p>
  
  <pre><code>use my_macro::{my_macro};
  
  pub trait TestTrait {
      #[my_macro]
      fn my_func(&amp;self, x: u8, y: String) -&gt; u32 {
          return 0;
      }
      #[my_macro]
      fn empty_func(&amp;mut self);
  }
  
  #[cfg(test)]
  mod tests {
      // Note this useful idiom: importing names from outer (for mod tests) scope.
      use super::*;
      #[derive(Default)]
      struct MyStruct{
          pub a: u8
      }
      impl TestTrait for MyStruct{
          #[my_macro]
          fn my_func(&amp;self, _x: u8, _y: String) -&gt; u32 {
              return 0;
          }
          #[my_macro]
          fn empty_func(&amp;mut self) {
              self.a = 5;
          }
      }
      #[test]
      fn test_empty_func() {
          let mut struc = MyStruct::default();
          let interface = &amp;mut struc as &amp;mut dyn TestTrait;
          interface.empty_func();
          assert_eq!(5, contract.a);
      }
  
      #[test]
      fn test_macros() {
              let mut struct = MyStruct::default();
              let interface = &amp;mut struc as &amp;mut dyn TestTrait;
              let zero = interface.my_func(8, "hello".to_string());
      }
  }
  </code></pre>
  
  <p>yields errors such as:</p>
  
  <pre class="lang-none prettyprint-override"><code>item: "fn my_func(&amp;self, x: u8, y: String) -&gt; u32 { return 0; }"
  item: "fn my_func(&amp;self, x: u8, y: String) -&gt; u32 { return 0; }"
  item: "fn empty_func(&amp;mut self);"
  item: "fn empty_func(&amp;mut self);"
  error: expected curly braces
    |
  9 |     fn empty_func(&amp;mut self);
    |                             ^
  
  error: expected curly braces
    |
  9 |     fn empty_func(&amp;mut self);
  </code></pre>
  
  <p>and </p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0599]: no method named `empty_func` found for mutable reference `&amp;mut dyn TestTrait` in the current scope
     |
  34 |         interface.empty_func();
     |                   ^^^^^^^^^^ method not found in `&amp;mut dyn TestTrait`
  
  error[E0599]: no method named `my_func` found for mutable reference `&amp;mut dyn TestTrait` in the current scope
     |
  42 |             let zero = interface.my_func(8, "hello".to_string());
     |                                  ^^^^^^^ method not found in `&amp;mut dyn TestTrait`
  </code></pre>
  
  <p>If I take off the procedural macro attribute, this compiles. What is going on here and what should I do differently? </p>