Remove proc-macros-error2 (#3646)

This commit is contained in:
Dániel Buga 2025-06-16 17:00:17 +02:00 committed by GitHub
parent 8cf0fc7153
commit f71127446b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 14 deletions

View File

@ -20,7 +20,6 @@ document-features = "0.2.11"
litrs = "0.4.1" litrs = "0.4.1"
object = { version = "0.36.7", default-features = false, features = ["read_core", "elf"], optional = true } object = { version = "0.36.7", default-features = false, features = ["read_core", "elf"], optional = true }
proc-macro-crate = "3.3.0" proc-macro-crate = "3.3.0"
proc-macro-error2 = "2.0.1"
proc-macro2 = "1.0.95" proc-macro2 = "1.0.95"
quote = "1.0.40" quote = "1.0.40"
syn = { version = "2.0.100", features = ["extra-traits", "full"] } syn = { version = "2.0.100", features = ["extra-traits", "full"] }

View File

@ -116,7 +116,6 @@ mod switch;
/// [`bytemuck::AnyBitPattern`]: https://docs.rs/bytemuck/1.9.0/bytemuck/trait.AnyBitPattern.html /// [`bytemuck::AnyBitPattern`]: https://docs.rs/bytemuck/1.9.0/bytemuck/trait.AnyBitPattern.html
/// [`bytemuck::Zeroable`]: https://docs.rs/bytemuck/1.9.0/bytemuck/trait.Zeroable.html /// [`bytemuck::Zeroable`]: https://docs.rs/bytemuck/1.9.0/bytemuck/trait.Zeroable.html
#[proc_macro_attribute] #[proc_macro_attribute]
#[proc_macro_error2::proc_macro_error]
pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream { pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream {
ram::ram(args, input) ram::ram(args, input)
} }
@ -142,7 +141,6 @@ pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream {
/// fn my_function() {} /// fn my_function() {}
/// ``` /// ```
#[proc_macro_attribute] #[proc_macro_attribute]
#[proc_macro_error2::proc_macro_error]
pub fn enable_doc_switch(args: TokenStream, input: TokenStream) -> TokenStream { pub fn enable_doc_switch(args: TokenStream, input: TokenStream) -> TokenStream {
switch::enable_doc_switch(args, input) switch::enable_doc_switch(args, input)
} }
@ -154,7 +152,6 @@ pub fn enable_doc_switch(args: TokenStream, input: TokenStream) -> TokenStream {
/// ///
/// If no priority is given, `Priority::min()` is assumed /// If no priority is given, `Priority::min()` is assumed
#[proc_macro_attribute] #[proc_macro_attribute]
#[proc_macro_error2::proc_macro_error]
pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream { pub fn handler(args: TokenStream, input: TokenStream) -> TokenStream {
interrupt::handler(args, input) interrupt::handler(args, input)
} }
@ -175,7 +172,6 @@ pub fn load_lp_code(input: TokenStream) -> TokenStream {
/// Marks the entry function of a LP core / ULP program. /// Marks the entry function of a LP core / ULP program.
#[cfg(any(feature = "is-lp-core", feature = "is-ulp-core"))] #[cfg(any(feature = "is-lp-core", feature = "is-ulp-core"))]
#[proc_macro_attribute] #[proc_macro_attribute]
#[proc_macro_error2::proc_macro_error]
pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
lp_core::entry(args, input) lp_core::entry(args, input)
} }

View File

@ -1,7 +1,6 @@
use darling::{Error, FromMeta, ast::NestedMeta}; use darling::{Error, FromMeta, ast::NestedMeta};
use proc_macro::{Span, TokenStream}; use proc_macro::TokenStream;
use proc_macro_error2::abort; use proc_macro2::{Ident, Span};
use proc_macro2::Ident;
use syn::{Item, parse}; use syn::{Item, parse};
#[derive(Debug, Default, darling::FromMeta)] #[derive(Debug, Default, darling::FromMeta)]
@ -37,10 +36,12 @@ pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream {
#[cfg(not(feature = "rtc-slow"))] #[cfg(not(feature = "rtc-slow"))]
if rtc_slow { if rtc_slow {
abort!( return syn::Error::new(
Span::call_site(), Span::call_site(),
"rtc_slow is not available for this target" "rtc_slow is not available for this target",
); )
.into_compile_error()
.into();
} }
let is_fn = matches!(item, Item::Fn(_)); let is_fn = matches!(item, Item::Fn(_));
@ -71,7 +72,9 @@ pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream {
#[unsafe(link_section = #section_name)] #[unsafe(link_section = #section_name)]
}, },
(_, Err(_)) => { (_, Err(_)) => {
abort!(Span::call_site(), "Invalid combination of ram arguments"); return syn::Error::new(Span::call_site(), "Invalid combination of ram arguments")
.into_compile_error()
.into();
} }
}; };
@ -90,12 +93,12 @@ pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream {
Ok(FoundCrate::Name(ref name)) => name, Ok(FoundCrate::Name(ref name)) => name,
_ => "crate", _ => "crate",
}, },
Span::call_site().into(), Span::call_site(),
); );
let assertion = quote::format_ident!("assert_is_{name}"); let assertion = quote::format_ident!("assert_is_{name}");
let Item::Static(ref item) = item else { let Item::Static(ref item) = item else {
abort!(item, "Expected a `static`"); return syn::Error::new(Span::call_site(), "Expected a `static`").into_compile_error();
}; };
let ty = &item.ty; let ty = &item.ty;
quote::quote! { quote::quote! {