diff --git a/derive-impl/Cargo.toml b/derive-impl/Cargo.toml index 8e81fba..53c271e 100644 --- a/derive-impl/Cargo.toml +++ b/derive-impl/Cargo.toml @@ -13,7 +13,7 @@ proc-macro = true [dependencies] proc-macro2 = { version = "1.0.24", features = ["span-locations"] } proc-macro-crate = "3.1.0" -proc-macro-error = "1.0.4" +proc-macro-error2 = "2.0.1" quote = "1.0.7" syn = "2.0.66" synstructure = "0.13.1" diff --git a/derive-impl/src/lib.rs b/derive-impl/src/lib.rs index 7fd1c3c..1c113e3 100644 --- a/derive-impl/src/lib.rs +++ b/derive-impl/src/lib.rs @@ -4,13 +4,11 @@ //! For example, the actual trait that we are deriving `MultihashDigest`, as well as the `Hasher` trait and //! the `UnsupportedCode` error type. -extern crate proc_macro; - mod multihash; mod utils; use proc_macro::TokenStream; -use proc_macro_error::proc_macro_error; +use proc_macro_error2::proc_macro_error; use synstructure::macros::{parse, DeriveInput}; use synstructure::{MacroResult, Structure}; diff --git a/derive-impl/src/multihash.rs b/derive-impl/src/multihash.rs index 9b8a15a..f1d68a9 100644 --- a/derive-impl/src/multihash.rs +++ b/derive-impl/src/multihash.rs @@ -112,14 +112,14 @@ impl<'a> From<&'a VariantInfo<'a>> for Hash { #[cfg(test)] panic!("{}", msg); #[cfg(not(test))] - proc_macro_error::abort!(ident, msg); + proc_macro_error2::abort!(ident, msg); }); let hasher = hasher.unwrap_or_else(|| { let msg = "Missing hasher attribute: e.g. #[mh(hasher = multihash::Sha2_256)]"; #[cfg(test)] panic!("{}", msg); #[cfg(not(test))] - proc_macro_error::abort!(ident, msg); + proc_macro_error2::abort!(ident, msg); }); Self { ident, @@ -156,7 +156,7 @@ fn parse_code_enum_attrs(ast: &syn::DeriveInput) -> syn::LitInt { #[cfg(test)] panic!("{}", msg); #[cfg(not(test))] - proc_macro_error::abort!(&ast.ident, msg); + proc_macro_error2::abort!(&ast.ident, msg); } } } @@ -184,7 +184,7 @@ fn error_code_duplicates(hashes: &[Hash]) { { let already_defined = uniq.get(code).unwrap(); let line = already_defined.to_token_stream().span().start().line; - proc_macro_error::emit_error!( + proc_macro_error2::emit_error!( &hash.code, msg; note = "previous definition of `{}` at line {}", quote!(#code), line; );