From d91806197d3b1a4e5578ec8e904160a3994b0b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Wed, 25 Jun 2025 16:20:14 +0200 Subject: [PATCH] Don't check default priority (#3693) --- esp-hal-procmacros/src/interrupt.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/esp-hal-procmacros/src/interrupt.rs b/esp-hal-procmacros/src/interrupt.rs index 193ac4d83..b663808c1 100644 --- a/esp-hal-procmacros/src/interrupt.rs +++ b/esp-hal-procmacros/src/interrupt.rs @@ -65,12 +65,17 @@ pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream { ); let priority = match priority { - Some(priority) => { - quote::quote!( #priority ) - } - _ => { - quote::quote! { #root::interrupt::Priority::min() } - } + Some(ref priority) => quote::quote!( { + const { + core::assert!( + !matches!(#priority, #root::interrupt::Priority::None), + "Priority::None is not supported", + ); + }; + + #priority + } ), + _ => quote::quote! { #root::interrupt::Priority::min() }, }; // XXX should we blacklist other attributes? @@ -115,15 +120,6 @@ pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream { quote::quote_spanned!(original_span => #f - const _: () = { - core::assert!( - match #priority { - #root::interrupt::Priority::None => false, - _ => true, - }, - "Priority::None is not supported"); - }; - #[allow(non_upper_case_globals)] #vis const #orig: #root::interrupt::InterruptHandler = #root::interrupt::InterruptHandler::new(#new, #priority); )