When writing a derive proc_macro and need to use it inside the crate that implements the type to be derived. Consider this abomination: `extern crate self as my_crate_name;` inside the crate defining the type. This way you can have an absolute reference to the type in the generated code and it will work inside and outside of your crate in question. I am sure there is a good reason rust does not provide the alias by default, but still i find it a bit funny I have to add this. 🀷

0

If you have a fediverse account, you can quote this note from your own instance. Search https://chaos.social/users/esden/statuses/115867197761041189 on your instance and quote it. (Note that quoting is not supported in Mastodon.)