While I was at RustConf, i had a conversation with someone that made me think about rustdoc’s old JSON output format. Up until early 2016, rustdoc was able to output JSON instead of its usual HTML (and also take it as input instead of the
lib.rs for a crate), but it was taken out because it was neglected, unused, and the tools team decided it wasn’t worth the effort of planning for its stabilization.
However, I wanted to take another look. We’ve done a lot in the two years since then, and it’s worth considering whether we can properly support something like this. To that end, i chalked some of my thoughts down and tried to think through some of the bigger design questions behind it. I wrote it as a potential RFC, but to be honest that was mainly so that i could have a template to put the hypothetical docs into, since i wanted to start specifying what the potential JSON would look like before trying to write the implementation.
Perhaps the biggest question is: what does this accomplish that
save-analysis doesn’t? The reasoning i wrote down was the rustdoc and the RLS care about different things, but the only real example i can think of offhand is that rustdoc’s JSON output would (for example) filter out private items by default. To be honest, i’m not familiar enough with the
save-analysis data to know whether rustdoc needs something it doesn’t currently show.
Does this seem decent? I’ve seen several requests to put something like this in, so this is basically me thinking through the design process as best i can.