From 0f6f868b2e255e9aeeaadd057904c166f66ef198 Mon Sep 17 00:00:00 2001 From: lights0123 Date: Sun, 9 Aug 2020 13:26:55 -0400 Subject: [PATCH] Cause an error in the #[entry] macro instead of avr-device --- macros/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 6498f68..eb1f158 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -58,7 +58,14 @@ pub fn entry( let stmts = block.stmts; let unsafety = f.sig.unsafety; - quote::quote!( + quote::quote! ( + #[cfg(not(any(doc, target_arch = "avr")))] + compile_error!( + "Ensure that you are using an AVR target! You may need to change \ + directories or pass a --target flag to cargo. See + https://github.com/Rahix/avr-device/pull/41 for more details." + ); + #(#attrs)* #[doc(hidden)] #[export_name = "main"]