Diagnostic-based compiler errors for proc_macro2
Use Diagnostic compiler messages from proc_macro2 code with Result-like syntax.
Provides a DiagnosticResult which stores a Diagnostic based upon the API of
[proc_macro::Diagnostic] and allows ? usage to return early from proc_macro2 code.
Note
This crate is a little opinionated in an attempt to make it simpler to create good compiler errors:
- Top-level diagnostics must be either an
Erroror aWarning - (Only)
Help(&Notes -> still to do) can be added to a diagnostic Errors always span the original call site - add a Help or Note to add information related to other spansWarnings will always finish with aNotedetailing the original call site- Multi-level nesting is not possible
Usage
# extern crate proc_macro;
use ;
use quote;