I'm thinking about pulling the rustc libsyntax AST pretty-printer out and converting it to use the
Syn AST. Would anyone else be interested in using such a crate? Any gotchas I might run into?
The background on this is that we use the libsyntax pretty-printer fairly heavily in c2rust and recently ran into some breaking changes that are making us rethink that dependency. Several interfaces we used to use are now crate-private, which makes sense. Rather than try to work around or change that, I think it makes more sense to build our own pretty-printer, starting from the existing code.
I've investigated using Quote+Syn, but unfortunately
to_tokens() by itself is insufficient for our use case; we need to inject comments into the output code. The compiler pretty-printer has limited support for comment handling, and we can extend that support if we break it out into a crate and use Syn instead of libsyntax. I couldn't find any other pretty-printers that handle comments, anyone know of one?