-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add Stable APIs to emit diagnostic messages #59
Comments
We could attempt do this entirely on crates.io with just the span information. There are crates that render diagnostics in the rustc style. I'll build a small demo. |
Here's a very hacky example of how to use annotate_snippets to render a diagnostic: https://github.com/oli-obk/smir_diagnostics the demo produces the following output: |
That's awesome! I didn't know the |
Maybe we can add methods to retrieve the byte range of a span and the file content, so users can easily integrate with a diagnostic crate such as |
Provide a mechanism to emit diagnostic messages using StableMIR's
Span
. Maybe provide methods to emit error, warning, and note.One possibility would be to provide an API similar to what is being proposed for proc_macro diagnostics:
We should probably also add a function
abort_if_errors()
to allow tool developers to end some validation stage if any error was detected.The text was updated successfully, but these errors were encountered: