Type size in proc-macro


Someone just asked

does anybody know how to get target’s word size inside a proc-macro function?

on IRC. The problem is that proc-macro code is run on the host, so sizes may be different to the target

The solution given was to use cfg!(target_pointer_width=".."), but this seems error prone. Is there (or should there be) any better solution?