This started as a discord discussion (https://internals.rust-lang.org/t/using-the-rustc-interface-crate/11982/22) with @bjorn3 and @mark-i-m and then evolved into a github issue (https://github.com/rust-lang/rust/issues/71770) discussion with @simulacrum . The original motivation was "I would like to be able to read the stream of diagnostics without having to buffer and parse JSON", but it seems this is an instance of a larger question: is rustc_interface intended to be a high-level interface for rustc?
rustc_interface seems to be missing many of the components you typically see in a compiler API like the Java Compiler API, or F# compiler service, or many others. Such as, documentation of how to do basic tasks like parsing and getting a pointer to a range, or the present example of a typed API for diagnostics. I am happy to help work on these things, but based on @simulacrum response in the github issue, I am now wondering whether rustc_interface is in fact intended to be a compiler-API in the tradition of these other compiler APIs I have mentioned.
No, I don't think it is, or at least not today
it's intended perhaps for internal consumption (e.g. clippy would also use it, I believe)
but not really for public consumption