Skip to content

Print diagnostics with non-owned source code #391

Answered by MattX
MattX asked this question in Q&A
Discussion options

You must be logged in to vote

In the end I've used a wrapper type that implements Diagnostic and delegates every method to a wrapped Diagnostic, except source_code(), which it gets from another field. Near the top-level of my code, I wrap the error with this type and bubble that up instead.

It's just a lot of boilerplate: https://gist.github.com/MattX/e6e01b453aad4778947e54a58c6f5be5

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MattX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants