Function report_error

Source
pub fn report_error<T: ToTokens, U: Display>(
    tokens: &T,
    message: U,
) -> TokenStream
Expand description

Uses the syn library’s Error struct to report an error in the form of a TokenStream, so that a proc macro can insert this token stream into its output and thereby report a detailed error message to the user.

The span of this error corresponds to the tokens parameter, so the user gets the relevant context for the error