// src/lib.rs
use proc_macro::TokenStream;
use syn::parse::{Error, ParseStream, Result};
use syn::{bracketed, parse_macro_input};
fn parse(input: ParseStream) -> Result<()> {
let bracketed;
bracketed!(bracketed in input);
bracketed.step(|cursor| {
let mut cursor = *cursor;
while let Some((_literal, rest)) = cursor.literal() {
cursor = rest;
}
Err(Error::new(cursor.span(), "literal parser is insatiable"))
})
}
#[proc_macro]
pub fn repro(input: TokenStream) -> TokenStream {
parse_macro_input!(input with parse);
TokenStream::new()
}
Diagnostic before this PR: no indication of where in the input we were parsing.
error: literal parser is insatiable
--> src/main.rs:3:1
|
3 | repro::repro!([1]);
| ^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `repro::repro` (in Nightly builds, run with -Z macro-backtrace for more info)
Example:
Diagnostic before this PR: no indication of where in the input we were parsing.
Diagnostic after: