When defining the 2 structs with the same name and implementing the typetag trait for both,
deserialization now fails at runtime with following error:
Error("non-unique tag of dyn Tester: \"MyStruct\"", line: 1, column: 18)
This totally makes sense why this happens, but is brittle and easy to break in larger projects without realising, given it's a runtime error. For me, this was a confusing bug(albeit not typetag's bug!) to track down.
typetag does currently provide #[typetag::serde(name = "foo")] that would get around this.
Would it be feasibly possible to make this a compile time error rather than runtime, by keeping track of generated type names in the typetag macro?
Amazing library!
When defining the 2 structs with the same name and implementing the typetag trait for both, deserialization now fails at runtime with following error:
This totally makes sense why this happens, but is brittle and easy to break in larger projects without realising, given it's a runtime error. For me, this was a confusing bug(albeit not typetag's bug!) to track down.
typetag does currently provide
#[typetag::serde(name = "foo")]
that would get around this. Would it be feasibly possible to make this a compile time error rather than runtime, by keeping track of generated type names in the typetag macro?MRE:
Note: whilst the author closed it himself, I think is technically the same issue as #69