Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hax-lib-protocol-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme.workspace = true
proc-macro = true

[dependencies]
proc-macro-error = "1.0.4"
proc-macro-error2 = { version = "2.0" }
proc-macro2.workspace = true
quote.workspace = true
syn = { version = "2.0", features = [
Expand Down
2 changes: 1 addition & 1 deletion hax-lib-protocol-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn init(
/// }
/// }
/// ```
#[proc_macro_error::proc_macro_error]
#[proc_macro_error2::proc_macro_error]
#[proc_macro_attribute]
pub fn init_empty(
attr: proc_macro::TokenStream,
Expand Down
2 changes: 1 addition & 1 deletion hax-lib/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "Hax-specific proc-macros for Rust programs"
proc-macro = true

[target.'cfg(hax)'.dependencies]
proc-macro-error = { version = "1.0.4" }
proc-macro-error2 = { version = "2.0" }
hax-lib-macros-types = { workspace = true }
paste = { version = "1.0.15" }
syn = { version = "2.0", features = ["full", "visit-mut", "visit"] }
Expand Down
14 changes: 7 additions & 7 deletions hax-lib/macros/src/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod prelude {
pub use crate::syn_ext::*;
pub use proc_macro as pm;
pub use proc_macro2::*;
pub use proc_macro_error::*;
pub use proc_macro_error2::*;
pub use quote::*;
pub use std::collections::HashSet;
pub use syn::spanned::Spanned;
Expand Down Expand Up @@ -751,7 +751,7 @@ macro_rules! make_quoting_item_proc_macro {
r#impl: ident_str == "impl" || ident_str == "both",
});
if !matches!(ident_str.as_str(), "impl" | "both" | "interface") {
proc_macro_error::abort!(
proc_macro_error2::abort!(
ident.span(),
"Expected `impl`, `both` or `interface`"
);
Expand Down Expand Up @@ -931,22 +931,22 @@ pub fn refinement_type(mut attr: pm::TokenStream, item: pm::TokenStream) -> pm::
let mut item = parse_macro_input!(item as syn::ItemStruct);

let syn::Fields::Unnamed(fields) = &item.fields else {
proc_macro_error::abort!(
proc_macro_error2::abort!(
item.generics.span(),
"Expected a newtype (a struct with one unnamed field), got one or more named field"
);
};
let paren_token = fields.paren_token;
let fields = fields.unnamed.iter().collect::<Vec<_>>();
let [field] = &fields[..] else {
proc_macro_error::abort!(
proc_macro_error2::abort!(
item.generics.span(),
"Expected a newtype (a struct with one unnamed field), got {} fields",
fields.len()
);
};
if !matches!(field.vis, syn::Visibility::Inherited) {
proc_macro_error::abort!(field.vis.span(), "This field was expected to be private");
proc_macro_error2::abort!(field.vis.span(), "This field was expected to be private");
}

let no_debug_assert = {
Expand All @@ -955,10 +955,10 @@ pub fn refinement_type(mut attr: pm::TokenStream, item: pm::TokenStream) -> pm::
(tokens.next(), tokens.next())
{
if ident.to_string() != "no_debug_runtime_check" {
proc_macro_error::abort!(ident.span(), "Expected 'no_debug_runtime_check'");
proc_macro_error2::abort!(ident.span(), "Expected 'no_debug_runtime_check'");
}
if comma.as_char() != ',' {
proc_macro_error::abort!(ident.span(), "Expected a comma");
proc_macro_error2::abort!(ident.span(), "Expected a comma");
}
attr = pm::TokenStream::from_iter(tokens);
true
Expand Down
28 changes: 10 additions & 18 deletions tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading