Skip to content

Conversation

TheLostLambda
Copy link
Contributor

One-liner sanding off a small rough edge I came across: using NamedSource<String> (instead of simply String) severely limits which traits can be derived for the wrapping diagnostic. In my case, I lost the ability to clone my error!

image

I've brought things in line with https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits, leaving out Copy, Display, and Default, since those derives are either not possible or don't feel useful. The ones I've added here make sure people can .clone() errors, compare them, sort them, and use them in HashSets / HashMaps.

I also added Ord derives to the SourceSpan and SourceOffset types for the same reason!

@zkat zkat merged commit 6f09250 into zkat:main Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants