Set Explicit Discriminants for Errors and Warnings
Opened this issue · 0 comments
InsertCreativityHere commented
Doing this would present 2 advantages:
- In the implementation of these diagnostics, we always pass a stringified error code:
slicec/src/diagnostics/errors.rs
Line 268 in fabd9d9
- Compile-time guarantee there aren't any duplicate error codes.
Right now, it's up to us to make sure we don't pass the same error code for two different enums.
But if we used discriminants, the Rust compiler ensures there's no duplicate values for us.