Don't check default priority (#3693)

This commit is contained in:
Dániel Buga 2025-06-25 16:20:14 +02:00 committed by GitHub
parent 99042a7d60
commit d91806197d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
)