From 36746f387a13c878298f39269541244dacbfbc50 Mon Sep 17 00:00:00 2001 From: CreepySkeleton Date: Sun, 5 Jul 2020 19:27:39 +0300 Subject: [PATCH] Add readme note --- README.md | 18 +++++++++++++----- src/lib.rs | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fb1da50..7fbe07c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,15 @@ This crate aims to make error reporting in proc-macros simple and easy to use. Migrate from `panic!`-based errors for as little effort as possible! -Also, there's ability to [append a dummy token stream][crate::dummy] to your errors. +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 +`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! + +So you can just use this crate and have *both* some of `proc_macro::Diagnostic` functionality +available on stable ahead of time and your error-reporting code future-proof. ```toml [dependencies] @@ -242,9 +250,9 @@ be dual licensed as above, without any additional terms or conditions. [compl_err]: https://doc.rust-lang.org/std/macro.compile_error.html [`proc_macro::Diagnostic`]: https://doc.rust-lang.org/proc_macro/struct.Diagnostic.html -[crate::dummy]: https://docs.rs/proc-macro-error/0.4/proc_macro_error/dummy/index.html -[crate::multi]: https://docs.rs/proc-macro-error/0.4/proc_macro_error/multi/index.html +[crate::dummy]: https://docs.rs/proc-macro-error/1/proc_macro_error/dummy/index.html +[crate::multi]: https://docs.rs/proc-macro-error/1/proc_macro_error/multi/index.html -[`abort_call_site!`]: https://docs.rs/proc-macro-error/0.4/proc_macro_error/macro.abort_call_site.html -[`abort!`]: https://docs.rs/proc-macro-error/0.4/proc_macro_error/macro.abort.html +[`abort_call_site!`]: https://docs.rs/proc-macro-error/1/proc_macro_error/macro.abort_call_site.html +[`abort!`]: https://docs.rs/proc-macro-error/1/proc_macro_error/macro.abort.html [guide]: https://docs.rs/proc-macro-error diff --git a/src/lib.rs b/src/lib.rs index bc86ad8..ae2d666 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,29 @@ //! This crate aims to make error reporting in proc-macros simple and easy to use. //! Migrate from `panic!`-based errors for as little effort as possible! //! -//! Also, there's ability to [append a dummy token stream](dummy/index.html) to your errors. +//! (Also, you can explicitly [append a dummy token stream](dummy/index.html) to your errors). +//! +//! To achieve his, 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 simply be +//! delegating to it, requiring no changes in your code! +//! +//! So you can just use this crate and have *both* some of `proc_macro::Diagnostic` functionality +//! available on stable ahead of time *and* your error-reporting code future-proof. +//! +//! ## Cargo features +//! +//! This crate provides *enabled by default* `syn-error` feature that gates +//! `impl From for Diagnostic` conversion. If you don't use `syn` and want +//! to cut off some of compilation time, you can disable ii via +//! +//! ```toml +//! [dependencies] +//! proc-macro-error = { version = "1", default-features = false } +//! ``` +//! +//! ***Please note that disabling this feature makes sense only if you don't depend on `syn` +//! directly or indirectly, and you very likely do.** //! //! ## Real world examples //!