proc-macro-error
Almost drop-in replacement to panics in proc-macros
1.0.4
326M downloads/mo
#335 most downloaded on crates.io
source
What this package is like to depend on
Last release 6 years ago
no release in 18 months
Release timing varies
gaps range from 1 weeks to 3 months
Most releases are documented
notes for 19 of 31 stable releases
4 versions withdrawn
withdrawn after publishing
7 years old
38 releases · first in 2019
0 releases in the last 12 months
see the full history below
Release timeline
38 releases · Jul 2019 to Jul 2020Releases
latest 38-
1.0.431 Jul 2020Release notes
Open source →SpanRangefacility is now public.- Docs have been improved.
- Introduced the
syn-errorfeature so you can opt-out from thesyndependency.
-
1.0.326 Jun 2020 -
1.0.209 Apr 2020 -
1.0.108 Apr 2020Release notes
Open source →proc-macro-hackis 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.
-
1.0.025 Mar 2020Release notes
Open source →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!
Improvements
- 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.
- Supported nested
-
0.4.1223 Mar 2020 -
0.4.1102 Mar 2020Release notes
Open source →build.rsno longer fails whenrustcdate could not be determined, (thanks toFabian Möllerfor noticing and toIgor Gnatenkofor fixing).
-
0.4.1029 Feb 2020Release notes
Open source →proc-macro-errordoesn't depend on syn[full] anymore, the compilation is ~30secs faster.
-
0.4.913 Feb 2020 -
0.4.801 Feb 2020 -
0.4.701 Feb 2020Release notes
Open source →- Now any type that implements
quote::ToTokenscan be used instead of spans. This allows for high quality error messages.
- Now any type that implements
-
0.4.631 Jan 2020 -
0.4.519 Jan 2020Release notes
Open source →Just a small intermediate release.
- Fix some bugs.
- Populate license files into subfolders.
-
0.4.413 Nov 2019 -
0.4.307 Nov 2019Nothing published for this version
-
0.4.107 Nov 2019 withdrawnRelease notes
Open source →- Fixed
__pme__suggestions not foundbug - Documentation improvements, links checked
- Fixed
-
0.4.006 Nov 2019 withdrawnRelease notes
Open source →New features
- "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_warningandemit_warning_call_site. Nightly only, they're ignored on stable. - Now
proc-macro-errordelegates toproc_macro::Diagnosticon nightly.
Breaking changes
MacroErroris now replaced byDiagnostic. Its API resemblesproc_macro::Diagnostic.Diagnosticdoes 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!.
Improvements
- Now
proc-macro-errorrenders 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.
- "help" messages that can have their own span on nightly, they
inherit parent span on stable.
-
0.3.420 Oct 2019Nothing published for this version
-
0.3.316 Oct 2019 -
0.3.216 Oct 2019 -
0.3.108 Oct 2019Nothing published for this version
-
0.3.008 Oct 2019Release notes
Open source →The crate has been completely rewritten from scratch!
Changes (most are breaking):
- Renamed macros:
span_error=>abortcall_site_error=>abort_call_site
filter_macro_errorswas replaced by#[proc_macro_error]attribute.set_dummynow takesTokenStreaminstead ofOption<TokenStream>- Support for multiple errors via
emit_errorandemit_call_site_error - New
macro_errormacro for building errors in format=like style. MacroErrorAPI had been reconsidered. It also now implementsquote::ToTokens.
- Renamed macros:
-
0.3.0-rc106 Oct 2019 pre-releaseNothing published for this version
-
0.3.0-rc.107 Oct 2019 pre-releaseNothing published for this version
-
0.2.602 Sep 2019Release notes
Open source →- Introduce support for dummy implementations via
dummy::set_dummy multi::*is now deprecated, will be completely rewritten in v0.3
- Introduce support for dummy implementations via
-
0.2.502 Sep 2019 withdrawnNothing published for this version
-
0.2.420 Aug 2019Nothing published for this version
-
0.2.316 Aug 2019Nothing published for this version
-
0.2.215 Aug 2019Nothing published for this version
-
0.2.115 Aug 2019 withdrawnNothing published for this version
-
0.2.015 Aug 2019Release notes
Open source →Breaking changes
trigger_errorreplaced withMacroError::triggerandfilter_macro_error_panicsis 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.*.
New features
- Ability to stack multiple errors via
multi::MultiMacroErrorsand emit them at once.
Improvements
- Now
MacroErrorimplementsstd::fmt::Displayinstead ofstd::string::ToString. MacroError::spaninherent method.From<MacroError> for proc_macro/proc_macro2::TokenStreamimplementations.AsRef/AsMut<String> for MacroErrorimplementations.
-
0.1.519 Jul 2019Nothing published for this version
-
0.1.419 Jul 2019Nothing published for this version
-
0.1.312 Jul 2019Nothing published for this version
-
0.1.212 Jul 2019Nothing published for this version
-
0.1.2-docfix12 Jul 2019 pre-releaseNothing published for this version
-
0.1.112 Jul 2019Nothing published for this version
-
0.1.011 Jul 2019Nothing published for this version