Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider using proc-macro-error to simplify the emission of error messages #52

Open
japaric opened this issue Aug 16, 2021 · 0 comments

Comments

@japaric
Copy link
Collaborator

japaric commented Aug 16, 2021

The analysis pass collects error messages manually like this:

rtic-syntax/src/analyze.rs

Lines 109 to 115 in b5389b4

error.push(syn::Error::new(
r.span(),
format!(
"Lock free shared resource {:?} is used by tasks at different priorities",
r.to_string(),
),
));

The proc-macro-error crate provides similar functionality: it lets you emit rustc-like error, notes and warnings messages with appropriate spans. It has an emit_error! API to collect error messages and a separate abort! API to terminate the proc-macro and emit all collected errors. I think using proc-macro-error API would simplify the error handling in the analysis pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant