Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Last active February 27, 2019 10:24
Show Gist options
  • Save yoshuawuyts/04be03f3790c17a5a5e983f13e4bfcb0 to your computer and use it in GitHub Desktop.
Save yoshuawuyts/04be03f3790c17a5a5e983f13e4bfcb0 to your computer and use it in GitHub Desktop.

Current

error: only the main function can be tagged with #[foob]
  --> tests/hello.rs:45:1
   |
45 | fn hello() {
   | ^^
error: aborting due to previous error
error: Could not compile `runtime`.
To learn more, run the command again with --verbose.                                                                                                                   [runtime:1]

Expected

error: only the main function can be tagged with #[foob]
  --> tests/hello.rs:45:1
   | 
44 | #[my_tag]
45 | fn hello() {
   | ^^
error: aborting due to previous error
error: Could not compile `runtime`.
To learn more, run the command again with --verbose.                                                                                                                   [runtime:1]
let name = &input.ident;
if name != "main" {
let tokens = quote_spanned! { name.span() =>
compile_error!("only the main function can be tagged with #[foob]");
};
return proc_macro::TokenStream::from(tokens);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment