title: How to get the content of a module passed to an inner attribute macro?
body: <p>So I have defined the following procedural macro:</p>
  
  <pre class="lang-rust prettyprint-override"><code>#[proc_macro_attribute]
  pub fn hello(attr: TokenStream, item: TokenStream) -&gt; TokenStream {
    println!("attr: {}", attr);
    println!("item: {}", item);
    item
  }
  </code></pre>
  
  <p>then I apply this proc macro to a non-inline module:</p>
  
  <pre class="lang-rust prettyprint-override"><code>// In file some_mod.rs
  #![hello]
  
  fn foo() {}
  fn bar() {}
  </code></pre>
  
  <p>The output of the compiler indicates that the item passed to the proc macro <code>hello</code> is <code>mod some_mod;</code>, without any items in the module. however I want to do some modifications to the content of the module <code>some_mod</code>.  </p>
  
  <p>I have figured out that inline module works:</p>
  
  <pre class="lang-rust prettyprint-override"><code>mod some_mod {
    #![hello]
    fn foo() { }
    fo bar() { }
  }
  </code></pre>
  
  <p>The item passed to my proc macro is <code>mod some_mod { fn foo() { } fn bar() { } }</code>.<br>
  But I will use my proc macro in a complex module hierarchy, I don't want to put all those modules in a single file.</p>
  
  <p>Is there any way to make my proc macro get the content of the non-inline module?</p>