The error messages of Rust are remarkable, creating them can be challenging, though. Rustc uses a Diagnostic struct and a DiagnosticBuilder to create these messages. For this project, I'd like to have something similar.
Things to keep in mind:
-
The Diagnostic object has to be FFI safe (Maybe it can first use Vec during construction and then swap to an FFI safe diagnostic)
-
The information of the Diagnostic backend should be the common denominator off all backends as it kind of dictates, what each backend has to provide as a lint emission mechanism.
Rust-analyzer supports rustc's diagnostic structure AFAIK, so it's most likely safe to take that as a rough example.
And probably plenty of other things I can't think of rn.
The error messages of Rust are remarkable, creating them can be challenging, though. Rustc uses a
Diagnosticstruct and aDiagnosticBuilderto create these messages. For this project, I'd like to have something similar.Things to keep in mind:
The
Diagnosticobject has to be FFI safe (Maybe it can first useVecduring construction and then swap to an FFI safe diagnostic)The information of the
Diagnosticbackend should be the common denominator off all backends as it kind of dictates, what each backend has to provide as a lint emission mechanism.Rust-analyzer supports rustc's diagnostic structure AFAIK, so it's most likely safe to take that as a rough example.
And probably plenty of other things I can't think of rn.