title: Report macro errors on func syn items
body: <p>I have the next function, that parses a body of a <code>proc-macro</code>.</p>
  <pre><code>pub fn user_body_builder(func: syn::ItemFn, macro_tokens: &amp;mut Vec&lt;TokenStream&gt;) -&gt; Result&lt;(), TokenStream&gt; {
      // Gets a Vec&lt;Stmt&gt; with all the staments in the body of the fn
      let function_statements = func.clone().block.stmts;
      
      for stmt in function_statements {
          let quote = quote! {#stmt};
          let quoterino  = quote
              .to_string()
              .parse();
          
          if quoterino.is_err() {
              return Err(
                  if quoterino.is_err() {
                      return Err(
                          syn::Error::new(stmt.span(), &quot;Macro error&quot;)
                              .to_compile_error()
                      )
          } else {
              macro_tokens.push(quoterino.unwrap());
          }
              )
          } else {
              macro_tokens.push(quoterino.unwrap());
          }
      }
      Ok(())
  }
  </code></pre>
  <p>When I introduce a syntax error on purpose on main, sometimes reports the error correctly, but sometimes not.</p>
  <p>And even when the report of the error it's done, I always face this:</p>
  <p><code>error[E0601]: main function not found in crate 'some_crate'</code></p>
  <p>What w'd be the correct way of handling and report code errors when a macro wraps a function body when faced?</p>
  <p><code>EDIT 1:</code>
  Changed <code>quote_spanned!</code> for <code>syn::Error::new</code>. Error it's the same.</p>
  <p><code>EDIT 2:</code>
  I've already found why when there's an error on main the compiler does not reach my function to handling the errors.</p>
  <pre><code>#[proc_macro_attribute]
  pub fn macro(_meta: CompilerTokenStream, input: CompilerTokenStream) -&gt; CompilerTokenStream {
      // Get the function that this attribute is attached to
      let func = parse_macro_input!(input as ItemFn);
  </code></pre>
  <p>The <code>parse_macro_input!(...)</code> macro throws the errors on main, so the compiler never reaches the code that handles the errors detected on the stmts.</p>