One of the things I think is really valuable in Rust a lot is the really good compiler error output you get in a terminal but also that they can be output to JSON or whatever for Rust Analyzer/whatever to also make use of.
A few times I've seen other libraries output a similar thing, but nearly always they seem to handcraft code themselves in their libraries that makes the output in a terminal look similar but it tends to be slightly hacky (without meaning any disrespect at all) and limited in scope compared to the things you can do in the Rust compiler.
Has there ever been consideration to abstracting some of the compiler code out into it's own crate that can be used by other languages? Has anyone ever attempted such a thing before? What would be the compiler teams thoughts on doing such a thing? I guess you'd lose some control over altering that code as quickly, but I suspect it's reasonably mature at this point too (at a guess).
I ask largely as I want to be able to output things in a similar style for something I'm writing but don't want to start depending on (and pretty sure it might not even be possible without pulling in large chunks of) the compiler code, no thank you.
You are probably looking for annotate-snippets. Cargo uses it already and rustc has an unstable option to use it, but doesn't yet unconditionally use it because it isn't yet on part with the builtin error formatter of rustc.
Awesome, thank you so much, I'll take a look. I've been searching for two days, should've clearly looked more carefully at the Cargo.toml in rustc_errors.