RFC - annotate-snippets crate


Hi all,

I just released the 0.1 version of a crate designed to provide rustc-like snippet annotations.

The crate is intended to cover all functionality currently provided by the rustc display errors with hopes that eventually it’ll be able to be used instead.

Without waiting for that, the crate may come useful for anyone working on parsers and wishing to display the parser’s errors in to the user.

I’m seeking feedback on the code, programming patterns used, rust-paradigms, and features needed to make it a viable replacement for rustc error display internal code.

Thanks, zb.


What are the issues with the similar code in rustc that this aims to solve? (i.e. what is the motivation?) Is it simply that the code is not available for use by other crates? Or maybe the rustc code is a disaster, so to speak? (I haven’t seen it)

Looking it over, I can see that a fair amount of effort went into this crate and its documentation, though I can’t speak for the needs of rustc.


Yes, the primaty motivation was that the code from rustc cannot be used outside. When asked about it on IRC I got feedback that a new crate should be written so that’s what I did.

I’d love to avoid having to maintain it exclusively for my parser (fluent-rs) so I hope to get some adoption from other parsers and if possible target replacing rustc to avoid effort duplication.