Skip to content

Commit

Permalink
add help message for #[macroquad::main] on a non-async function
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrgani committed Jan 12, 2025
1 parent 2f7f3c8 commit 1454f15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion macroquad_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
};

if let TokenTree::Ident(ident) = source.next().unwrap() {
assert_eq!(format!("{}", ident), "async");
assert_eq!(
format!("{}", ident),
"async",
"[macroquad::main] is allowed only for async functions"
);

modified.extend(std::iter::once(TokenTree::Ident(ident)));
} else {
Expand Down

0 comments on commit 1454f15

Please sign in to comment.