SpanRange
facility is now public.- Docs have been improved.
- Introduced the
syn-error
feature so you can opt-out from thesyn
dependency.
- Corrected a few typos.
- Fixed the
emit_call_site_warning
macro.
- An obsolete note was removed from documentation.
proc-macro-hack
is now well tested and supported. Not sure aboutproc-macro-nested
, please fill a request if you need it.- Fixed
emit_call_site_error
. - Documentation improvements.
I believe the API can be considered stable because it's been a few months without breaking changes, and I also don't think this crate will receive much further evolution. It's perfect, admit it.
Hence, meet the new, stable release!
- Supported nested
#[proc_macro_error]
attributes. Well, you aren't supposed to do that, but I caught myself doing it by accident on one occasion and the behavior was... surprising. Better to handle this smooth.
- Error message on macros' misuse is now a bit more understandable.
build.rs
no longer fails whenrustc
date could not be determined, (thanks toFabian Möller
for noticing and toIgor Gnatenko
for fixing).
proc-macro-error
doesn't depend on syn[full] anymore, the compilation is ~30secs faster.
- New function:
append_dummy
.
- Support for children messages
- Now any type that implements
quote::ToTokens
can be used instead of spans. This allows for high quality error messages.
From<syn::Error>
implementation doesn't lose span info anymore, see #6.
Just a small intermediate release.
- Fix some bugs.
- Populate license files into subfolders.
- Fix
abort_if_dirty
+ warnings bug - Allow trailing commas in macros
- FINALLY fixed
__pme__suggestions not found
bug
- Fixed
__pme__suggestions not found
bug - Documentation improvements, links checked
- "help" messages that can have their own span on nightly, they
inherit parent span on stable.
let cond_help = if condition { Some("some help message") else { None } }; abort!( span, // parent span "something's wrong, {} wrongs in total", 10; // main message help = "here's a help for you, {}", "take it"; // unconditional help message help =? cond_help; // conditional help message, must be Option note = note_span => "don't forget the note, {}", "would you?" // notes can have their own span but it's effective only on nightly )
- Warnings via
emit_warning
andemit_warning_call_site
. Nightly only, they're ignored on stable. - Now
proc-macro-error
delegates toproc_macro::Diagnostic
on nightly.
MacroError
is now replaced byDiagnostic
. Its API resemblesproc_macro::Diagnostic
.Diagnostic
does not implementFrom<&str/String>
soResult<T, &str/String>::abort_or_exit()
won't work anymore (nobody used it anyway).macro_error!
macro is replaced withdiagnostic!
.
- Now
proc-macro-error
renders notes exactly just like rustc does. - We don't parse a body of a function annotated with
#[proc_macro_error]
anymore, only looking at the signature. This should somewhat decrease expansion time for large functions.
- Now you can use any word instead of "help", undocumented.
- Introduced support for "help" messages, undocumented.
- Renamed macros:
span_error
=>abort
call_site_error
=>abort_call_site
filter_macro_errors
was replaced by#[proc_macro_error]
attribute.set_dummy
now takesTokenStream
instead ofOption<TokenStream>
- Support for multiple errors via
emit_error
andemit_call_site_error
- New
macro_error
macro for building errors in format=like style. MacroError
API had been reconsidered. It also now implementsquote::ToTokens
.
- Introduce support for dummy implementations via
dummy::set_dummy
multi::*
is now deprecated, will be completely rewritten in v0.3
trigger_error
replaced withMacroError::trigger
andfilter_macro_error_panics
is hidden from docs. This is not quite a breaking change since users weren't supposed to use these functions directly anyway.- All dependencies are updated to
v1.*
.
- Ability to stack multiple errors via
multi::MultiMacroErrors
and emit them at once.
- Now
MacroError
implementsstd::fmt::Display
instead ofstd::string::ToString
. MacroError::span
inherent method.From<MacroError> for proc_macro/proc_macro2::TokenStream
implementations.AsRef/AsMut<String> for MacroError
implementations.
- An easy way to report errors inside within a proc-macro via
span_error
,call_site_error
andfilter_macro_errors
.