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.
abort_if_dirty
+ warnings bug__pme__suggestions not found
bug__pme__suggestions not found
buglet 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 )
emit_warning
and emit_warning_call_site
. Nightly only, they're ignored on stable.proc-macro-error
delegates to proc_macro::Diagnostic
on nightly.MacroError
is now replaced by Diagnostic
. Its API resembles proc_macro::Diagnostic
.Diagnostic
does not implement From<&str/String>
so Result<T, &str/String>::abort_or_exit()
won't work anymore (nobody used it anyway).macro_error!
macro is replaced with diagnostic!
.proc-macro-error
renders notes exactly just like rustc does.#[proc_macro_error]
anymore, only looking at the signature. This should somewhat decrease expansion time for large functions.span_error
=> abort
call_site_error
=> abort_call_site
filter_macro_errors
was replaced by #[proc_macro_error]
attribute.set_dummy
now takes TokenStream
instead of Option<TokenStream>
emit_error
and emit_call_site_error
macro_error
macro for building errors in format=like style.MacroError
API had been reconsidered. It also now implements quote::ToTokens
.dummy::set_dummy
multi::*
is now deprecated, will be completely rewritten in v0.3trigger_error
replaced with MacroError::trigger
and filter_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.v1.*
.multi::MultiMacroErrors
and emit them at once.MacroError
implements std::fmt::Display
instead of std::string::ToString
.MacroError::span
inherent method.From<MacroError> for proc_macro/proc_macro2::TokenStream
implementations.AsRef/AsMut<String> for MacroError
implementations.span_error
, call_site_error
and filter_macro_errors
.