From ccf8471a125a296e95a773b10ada70373d93cba5 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sun, 1 Sep 2024 20:02:13 +0100 Subject: [PATCH] Rename to proc-macro-error2 --- Cargo.toml | 2 +- README.md | 8 ++++---- proc-macro-error-attr/src/lib.rs | 2 +- src/dummy.rs | 4 ++-- src/lib.rs | 2 +- test-crate/Cargo.toml | 2 +- test-crate/lib.rs | 4 ++-- tests/runtime-errors.rs | 2 +- tests/ui/misuse.rs | 2 +- tests/ui/not_proc_macro.rs | 2 +- tests/ui/unknown_setting.rs | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 63f1e72..801d837 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "proc-macro-error" +name = "proc-macro-error2" authors = [ "CreepySkeleton ", "GnomedDev ", diff --git a/README.md b/README.md index 312ff42..a833eb2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Migrate from `panic!`-based errors for as little effort as possible! Also, you can explicitly [append a dummy token stream][crate::dummy] to your errors. -To achieve his, this crate serves as a tiny shim around `proc_macro::Diagnostic` and +To achieve this, this crate serves as a tiny shim around `proc_macro::Diagnostic` and `compile_error!`. It detects the most preferable way to emit errors based on compiler's version. When the underlying diagnostic type is finally stabilized, this crate will be simply delegating to it, requiring no changes in your code! @@ -18,7 +18,7 @@ available on stable ahead of time and your error-reporting code future-proof. ```toml [dependencies] -proc-macro-error = "1.0" +proc-macro-error2 = "2.0" ``` *Supports rustc 1.31 and up* @@ -64,7 +64,7 @@ And this is what your users will see in their IDE: ### Panic-like usage ```rust -use proc_macro_error::{ +use proc_macro_error2::{ proc_macro_error, abort, abort_call_site, @@ -111,7 +111,7 @@ pub fn make_answer(input: TokenStream) -> TokenStream { ### `proc_macro::Diagnostic`-like usage ```rust -use proc_macro_error::*; +use proc_macro_error2::*; use proc_macro::TokenStream; use syn::{spanned::Spanned, DeriveInput, ItemStruct, Fields, Attribute , parse_macro_input}; use quote::quote; diff --git a/proc-macro-error-attr/src/lib.rs b/proc-macro-error-attr/src/lib.rs index 3cc8a25..2ae9003 100644 --- a/proc-macro-error-attr/src/lib.rs +++ b/proc-macro-error-attr/src/lib.rs @@ -89,7 +89,7 @@ fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream { quote!(|| #block) }; - quote!( ::proc_macro_error::entry_point(#closure, #is_proc_macro_hack) ) + quote!( ::proc_macro_error2::entry_point(#closure, #is_proc_macro_hack) ) } fn detect_proc_macro_hack(attrs: &[Attribute]) -> bool { diff --git a/src/dummy.rs b/src/dummy.rs index 3630127..0da03be 100644 --- a/src/dummy.rs +++ b/src/dummy.rs @@ -9,7 +9,7 @@ //! //! ```rust,ignore //! use proc_macro::TokenStream; -//! use proc_macro_error::*; +//! use proc_macro_error2::*; //! //! trait MyTrait { //! fn do_thing(); @@ -72,7 +72,7 @@ //! //! ```rust,ignore //! use proc_macro::TokenStream; -//! use proc_macro_error::*; +//! use proc_macro_error2::*; //! //! trait MyTrait { //! fn do_thing(); diff --git a/src/lib.rs b/src/lib.rs index c3aae8d..5fc0dbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -206,7 +206,7 @@ //! > If you have some type from `proc_macro` or `syn` to point to, do not call `.span()` //! > on it but rather use it directly: //! > ```no_run -//! > # use proc_macro_error::abort; +//! > # use proc_macro_error2::abort; //! > # let input = proc_macro2::TokenStream::new(); //! > let ty: syn::Type = syn::parse2(input).unwrap(); //! > abort!(ty, "BOOM"); diff --git a/test-crate/Cargo.toml b/test-crate/Cargo.toml index 0d5ecbe..146bfd4 100644 --- a/test-crate/Cargo.toml +++ b/test-crate/Cargo.toml @@ -13,7 +13,7 @@ path = "lib.rs" proc-macro = true [dependencies] -proc-macro-error = { path = "../" } +proc-macro-error2 = { path = "../" } quote = "1" proc-macro2 = "1" diff --git a/test-crate/lib.rs b/test-crate/lib.rs index 3b413ae..d50b983 100644 --- a/test-crate/lib.rs +++ b/test-crate/lib.rs @@ -1,5 +1,5 @@ use proc_macro2::{Span, TokenStream}; -use proc_macro_error::{ +use proc_macro_error2::{ abort, abort_call_site, diagnostic, emit_call_site_error, emit_call_site_warning, emit_error, emit_warning, proc_macro_error, set_dummy, Diagnostic, Level, OptionExt, ResultExt, SpanRange, }; @@ -199,7 +199,7 @@ pub fn append_dummy(input: proc_macro::TokenStream) -> proc_macro::TokenStream { impl Default for NeedDefault }); - proc_macro_error::append_dummy(quote!({ + proc_macro_error2::append_dummy(quote!({ fn default() -> Self { NeedDefault::A } diff --git a/tests/runtime-errors.rs b/tests/runtime-errors.rs index 13108a2..8ec211c 100644 --- a/tests/runtime-errors.rs +++ b/tests/runtime-errors.rs @@ -1,4 +1,4 @@ -use proc_macro_error::*; +use proc_macro_error2::*; #[test] #[should_panic = "proc-macro-error API cannot be used outside of"] diff --git a/tests/ui/misuse.rs b/tests/ui/misuse.rs index 097e385..dd86c0f 100644 --- a/tests/ui/misuse.rs +++ b/tests/ui/misuse.rs @@ -1,4 +1,4 @@ -use proc_macro_error::abort; +use proc_macro_error2::abort; struct Foo; diff --git a/tests/ui/not_proc_macro.rs b/tests/ui/not_proc_macro.rs index e241c5c..03c596b 100644 --- a/tests/ui/not_proc_macro.rs +++ b/tests/ui/not_proc_macro.rs @@ -1,4 +1,4 @@ -use proc_macro_error::proc_macro_error; +use proc_macro_error2::proc_macro_error; #[proc_macro_error] fn main() {} diff --git a/tests/ui/unknown_setting.rs b/tests/ui/unknown_setting.rs index d8e58ea..5e54a89 100644 --- a/tests/ui/unknown_setting.rs +++ b/tests/ui/unknown_setting.rs @@ -1,4 +1,4 @@ -use proc_macro_error::proc_macro_error; +use proc_macro_error2::proc_macro_error; #[proc_macro_error(allow_not_macro, assert_unwind_safe, trololo)] fn main() {}