I had looked for one in the past (about 9 months ago), but there wasn’t a “ready made, plug things in” crate. Rustc’s source for this (librustc_errors) is coupled to its own syntax crate (libsyntax_pos).
That said, if you were going to roll your own, Rustc uses
termcolor. I did wish for something that allowed you to go, given:
- (a list of) Files + contents (may be read on the fly?)
- a list of "
Problem"s, which hold:
- Files that the problem relates to
- Info about the location / indices of where the problem exists in the file(s)
- Error code
Suggestion / hint / help
Print out the pretty message. Which means the crate’s responsibility is to calculate the spacing and do the colour formatting etcetera.
Ya, I thought about it but haven’t done it =D.