When macro sees a type `X` macro can never be sure whether it's `&str` as Rust allows type alias. If `X` is not `&str` it may also be a struct that contains `&str`, still macro cannot know.
Wasm-bindgen workarounds this issue by generating "fake functions" then read and remove them in CLI:
https://wasm-bindgen.github.io/wasm-bindgen/contributing/des...
Zig comptime allows getting full type information. This is one advantage of Zig.
The issue was that the deserializer could produce non-borrowable strings at runtime, which cannot be used to create an instance of this type and hence caused a runtime panic.
Catching this should be possible (even without precise type informations) but I'm not sure it can be done without breaking changes to the Deserializer trait. It would also suffer from false positives since sometimes you might know that the inputs you will deserialize only include strings that can be deserialized in this way.